Mount a Link entry to Home to create short url #8539
-
Statamic v4.14.0 Is it possible to mount a collection, containing only redirect links, directly to the home page to create a short url system? I realise I could just create a Link entry directly within the Pages collection and job would be done. But, if possible, it would be nice to separate out this functionality for my users to make the purpose more clear to them, and to prevent the Pages collection becoming cluttered. They use these short urls for marketing campaigns on a regular basis. I have tried creating a collection called short_urls that only has one blueprint: /content/collections/short_urls.yaml title: 'Short URLs'
template: default
layout: layout
mount: 47381bd8-b293-430a-b089-4f2b78ab9b76 <-- this is the id for the home page
revisions: false
sort_dir: asc
date_behavior:
past: public
future: private
preview_targets:
-
label: Entry
url: '{permalink}'
refresh: true /resources/blueprints/collections/short_urls/link.yaml title: Link
tabs:
main:
sections:
-
fields:
-
handle: title
field:
type: text
-
handle: redirect
field:
type: link
required: true While I was able to happily add a number of short_urls, none of them work and just display /content/collections/short_urls/collections.md ---
id: 2930438a-8c7a-46fb-ad19-5e81987dee01
blueprint: link
title: 'Equipment collections'
redirect: 'entry::075bf632-ab33-4def-9a98-d3bac2662250'
updated_by: a307cf86-c614-4ac5-b366-b0f15e25551a
updated_at: 1691006934
--- Have I missed out something or is this not possible to achieve? Thank you ❤️ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Nvm I was being a plonker... 🙄 I just needed to add a route instead of a mount point: /content/collections/short_urls.yaml title: 'Short URLs'
template: default
layout: layout
route: /{slug}
revisions: false
sort_dir: asc
date_behavior:
past: public
future: private
preview_targets:
-
label: Entry
url: '{permalink}'
refresh: true |
Beta Was this translation helpful? Give feedback.
Nvm I was being a plonker... 🙄
I just needed to add a route instead of a mount point:
/content/collections/short_urls.yaml