4 ms·
Let the "name" in the url be irrelevant. Build your links so that there is a unique identifier in the url that takes you to the page you want that will never c
by fnid2 17y ago
Let the "name" in the url be irrelevant. Build your links so that there is a unique identifier in the url that takes you to the page you want that will never change. Then the name can change frequently without breaking links.
So if you have an album like this:
http://albumsite.com/albums/1/This_Great_Album http://albumsite.com/albums/1/This_Great_Album and the name changes to This great cd, then the url becomes http://albumsite.com/albums/1/This_Great_cd http://albumsite.com/albums/1/This_Great_cd and both links continue to work forever. Where the unique identifier in this case is 1.
Of course that makes users have to know what the unique ID is, but you can put the permalink on the page.
- smackfu 17y agoAn example in the wild: http://ask.metafilter.com/147349/Government-funding-for-a-new-UK-limited-company http://ask.metafilter.com/147349/Government-funding-for-a-ne... Everything after the number is just for humans.
- fnid2 17y agoIn practice, I use a slight enhancement. Not only does the url contain the ID to the element, but changing a part of it can tell the site how to display the data. For example: http://www.shellcompanyfinder.com/ShellCompanies/7845/11/NathanMyhrvoldsIntellectualVentures http://www.shellcompanyfinder.com/ShellCompanies/7845/11/Nat... Is a url that shows the data for a human. http://www.shellcompanyfinder.com/ShellCompanies/7845/35/NathanMyhrvoldsIntellectualVentures http://www.shellcompanyfinder.com/ShellCompanies/7845/35/Nat... or http://www.shellcompanyfinder.com/ShellCompanies/7845/json/NathanMyhrvoldsIntellectualVentures http://www.shellcompanyfinder.com/ShellCompanies/7845/json/N... Will show the data in JSON format. Or you can get it in CSV if you prefer: http://www.shellcompanyfinder.com/ShellCompanies/7845/csv/NathanMyhrvoldsIntellectualVentures http://www.shellcompanyfinder.com/ShellCompanies/7845/csv/Na... Makes it easy to show human forms and also keep it accessible to automation and integration in an easy and consistent manner.
- semanticist 17y agoWhy not use .json/.csv instead of embedding it midway through the URL?
- chrisbolt 17y agoEverything after the number is just for humans. ...or search engines
- vog 17y agoIt's a nice idea, but it defeats the idea of using URIs as identifiers. In your example, there are three identifiers for one and the same thing: http://albumsite.com/albums/1 http://albumsite.com/albums/1/This_Great_Album http://albumsite.com/albums/1/This_Great_cd If the latter two URLs were redirections to the first one, that issue would be fixed. But then the human readable parts wouldn't appear in the browser's URL line anymore.