How do I set a page's URI anyhow?

Created by josh
July 25, 2020 10:13:31 AM PDT (Revised July 25, 2020 10:26:38 AM PDT )


Typically, content management systems allow you to manually set the URI of a page. With SEO and structure consistency in mind, URI's for CMS generated pages are built automatically.

This is how it works: Each content body type has a formula for what the URI should look like. For basic pages, blog landing pages and blog category pages, they are simply the SEO transformed version of the H1 title tag. SEO transformation is the process of lowercasing, converting all non-alphanumeric characters to dashes, then trimming dashes off the start/ends of strings, and finally removing any sequential dashes. For example "101 Ways to Decorate your House for the Holidays!" would end up looking like "101-ways-to-decorate-your-house-for-the-holidays". Blog articles, by default, have a more complex URI pattern - they include the date and author in addition to the page title (see this page's URI as an example).

For every page that has a Parent Content associated with it, the URI uses the formula for the particular content body type and is appended to the end of the parent page's URI. If you're setting up a blog for the site, you might have a blog landing page at the URI of /blogs/. For a category page that is a child of the blog landing page, a category of "General Stuff" would adhere to the URI of /blogs/general-stuff/. A blog article, a child of the category, called "My First General Blog Post" would then live at /blogs/general-stuff/johndoe-2020-07-25-my-first-general-blog-post/. Now, if this is what you're really writing in real life, maybe spend some time spicing up you're creativity wink

If the URI is based on the title of a particular page, what happens if I change the title of the page? Does it change the URI of the page and its children?

Yes. If you have a page located at /lorem/ipsum/foo/bar/, and you edit the page /lorem/ by changing the title from "Lorem" to "Longboard" (sorry, I get weird with examples), the URI of that page is immediately changed to /longboard/. Each child page will eventually sync up to the new URI scheme too, but this doesn't happen simultaneously. When a user then visits any of the page URIs of /lorem/ipsum/, /lorem/ipsum/foo/ or /lorem/ipsum/foo/bar/, the page looks for any changes upstream and will permanently redirect (HTTP/1.1 301) to /longboard/ipsum/, /longboard/ipsum/foo/, and /longboard/ipsum/foo/bar/, respectively. This redirect is captured and visible in the URI Redirect Management admin panel (/admin/redirects/).

In a future version of Gaseous, the URI scheme for each content type will be customizable.