Open delphidabbler opened 2 years ago
It can be done with jekyll-redirect-from
.
However the plugin will create 200+ numbered .html
files in the root directory. This could cause a problem if there's ever a 404.html
custom error page and the number of tips becomes >= 404!
It may be better to rename tips
as tip
: it feels more intuitive to me to request tips.delphidabbler.com/tip/42
than tips.delphidabbler.com/tips/42
.
Another possibility is to rename tips
as id
.
If tips
does get renamed we would need to add a
redirect_from:
- /tips/xxx
statement to every tip's front matter, where xxx
is the tip number.
Another possibility may be to use a query string for the tip id, e.g. tips.delphidabbler.com/?t=42
.
Maybe an anchor could be used instead: tips.delphidabbler.com/#42
But then the main index.html
would have to check for the query string or anchor using Javascript and either redirect to the tip page if there's a query string or display the home page if not.
Neither approach looks pretty!
Yet another possibility is to
Rename tips
directory to tip
as suggested above
Add the required
redirect_from:
- /tips/xxx
front matter to redirect from tips
.
Add a further entry to the redirect_from
front matter:
redirect_from:
- /tips/xxx
- /t/xxx
to add support for urls of the form tips.delphidabbler.com/t/xxx
.
This way all the following forms of URL would be valid:
tips.delphidabbler.com/tip/xxx
(the canonical form)tips.delphidabbler.com/t/xxx
(the shorthand form)tips.delphidabbler.com/tips/xxx
(the old style form)Charging the canonical form from tips.delphidabbler.com/tips/xxx
to tips.delphidabbler.com/tip/xxx
might give Google's canonical form algorithm a headache for a while though!
Using the URL
tips.delphidabbler.com/<n>
instead oftips.delphidabbler.com/tips/<n>
is much friendlier. Is there any way to do this using thejekyll-redirect-from
plugin?