2013-08-10 15:35:34 +01:00
|
|
|
---
|
|
|
|
title: "Aliases"
|
2013-08-17 08:34:25 -04:00
|
|
|
date: "2013-07-09"
|
|
|
|
aliases:
|
2013-08-10 15:35:34 +01:00
|
|
|
- /doc/redirects/
|
|
|
|
- /doc/alias/
|
2013-08-17 08:34:25 -04:00
|
|
|
- /doc/aliases/
|
2014-05-27 18:32:57 -04:00
|
|
|
weight: 10
|
2014-04-23 03:00:11 -04:00
|
|
|
menu:
|
|
|
|
main:
|
|
|
|
parent: 'extras'
|
2014-05-27 18:32:57 -04:00
|
|
|
prev: "/taxonomies/ordering"
|
|
|
|
next: "/extras/builders"
|
2013-08-10 15:35:34 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
For people migrating existing published content to Hugo theres a good chance
|
|
|
|
you need a mechanism to handle redirecting old urls.
|
|
|
|
|
|
|
|
Luckily, this can be handled easily with aliases in Hugo.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
**content/posts/my-awesome-blog-post.md**
|
2014-05-15 09:58:55 -04:00
|
|
|
|
|
|
|
---
|
|
|
|
aliases:
|
|
|
|
- /posts/my-original-url/
|
|
|
|
- /2010/even-earlier-url.html
|
|
|
|
---
|
2013-08-10 15:35:34 +01:00
|
|
|
|
|
|
|
Now when you go to any of the aliases locations they
|
|
|
|
will redirect to the page.
|
|
|
|
|
|
|
|
## Important Behaviors
|
|
|
|
|
|
|
|
1. *Hugo makes no assumptions about aliases. They also don't change based
|
2013-09-13 16:06:39 -07:00
|
|
|
on your UglyUrls setting. You need to provide absolute path to your webroot and the
|
2013-08-10 15:35:34 +01:00
|
|
|
complete filename or directory.*
|
|
|
|
|
|
|
|
2. *Aliases are rendered prior to any content and will be overwritten by
|
|
|
|
any content with the same location.*
|