Uris
Last updated
Last updated
A uri is binding between a publicly accessible url and a specific in your Clay instance. When your browsing the web you're generally navigating between human-readable URLs like or . But when you're creating and editing pages in Clay you're normally dealing with page instances with random ids, like . This is where uris come in.
Uris are a bridge between a public facing url and a specific page instance. When a page is published a public url for the page is determined (), and when that happens a uri is created.
A uri is the most simple data structure in Clay and follows the following pattern: domain.com/_uris/:id
The :id
value for a uri is a base64 encoded string of a public url without the scheme. For example, if we're trying to find the uri that for , we must simply base64 encode the url without https://
and we'll be able to find the specific uri:
If you follow that uri above, you'll see that it's value is simply a text string which points to a specific page, thus forming a bridge between a public url and a specific page instance.
But what happens if a page is published and then edited in such a way that changes the public url? Amphora handles the redirects for you!
If Amphora finds that a previously published page's public url is changing, a redirect will be made. Internally Amphora is changing the original uri to point to a new uri for the new public url. When a user requests the old url, Amphora will respond with a 301
status and redirect the user to the new url. Handling this internally allows editors to iterate on their content without already shared links losing their content.
When a request for comes into Clay, the following happens:
The url is base64 encoded without the scheme of the request, this forms the id
of the uri.
A lookup for the specific uri is performed.
a. If it's a page instance, proceed
b. If it's another uri, redirect and restart the process
c. If it doesn't exist, send a 404
Proceed to compose the page and render it in the requested format