2013-08-10 14:35:34 +00:00
|
|
|
---
|
2013-08-17 12:34:25 +00:00
|
|
|
aliases:
|
2014-05-29 22:42:05 +00:00
|
|
|
- /doc/redirects/
|
|
|
|
- /doc/alias/
|
|
|
|
- /doc/aliases/
|
|
|
|
date: 2013-07-09
|
2014-04-23 07:00:11 +00:00
|
|
|
menu:
|
|
|
|
main:
|
2014-05-29 22:42:05 +00:00
|
|
|
parent: extras
|
|
|
|
next: /extras/builders
|
|
|
|
prev: /taxonomies/ordering
|
|
|
|
title: Aliases
|
|
|
|
weight: 10
|
2013-08-10 14:35:34 +00:00
|
|
|
---
|
|
|
|
|
2014-09-03 04:12:26 +00:00
|
|
|
For people migrating existing published content to Hugo, there's a good chance
|
2014-08-31 11:08:36 +00:00
|
|
|
you need a mechanism to handle redirecting old URLs.
|
2013-08-10 14:35:34 +00:00
|
|
|
|
|
|
|
Luckily, this can be handled easily with aliases in Hugo.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
**content/posts/my-awesome-blog-post.md**
|
2014-05-15 13:58:55 +00:00
|
|
|
|
2015-01-17 07:45:53 +00:00
|
|
|
<table class="table">
|
|
|
|
<tr>
|
|
|
|
<th>TOML</th><th>YAML</th>
|
|
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
|
|
<td><pre><code>---
|
|
|
|
aliases:
|
|
|
|
- /posts/my-original-url/
|
|
|
|
- /2010/even-earlier-url.html
|
|
|
|
---
|
|
|
|
</code></pre></td>
|
|
|
|
<td><pre><code>+++
|
|
|
|
aliases = [
|
|
|
|
"/posts/my-original-url/",
|
|
|
|
"/2010/even-earlier-url.html"
|
|
|
|
]
|
|
|
|
+++
|
|
|
|
</code></pre></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2013-08-10 14:35:34 +00:00
|
|
|
|
2014-09-03 04:12:26 +00:00
|
|
|
Now when you go to any of the aliases locations, they
|
2013-08-10 14:35:34 +00:00
|
|
|
will redirect to the page.
|
|
|
|
|
|
|
|
## Important Behaviors
|
|
|
|
|
|
|
|
1. *Hugo makes no assumptions about aliases. They also don't change based
|
2013-09-13 23:06:39 +00:00
|
|
|
on your UglyUrls setting. You need to provide absolute path to your webroot and the
|
2013-08-10 14:35:34 +00:00
|
|
|
complete filename or directory.*
|
|
|
|
|
|
|
|
2. *Aliases are rendered prior to any content and will be overwritten by
|
|
|
|
any content with the same location.*
|