mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-02 10:49:11 -05:00
ba44e860a3
* Add meta author, description and generator tags * Add Hugo version beside the logo and in the footer * Suggest the user to run `go get -u -v` to update dependencies * Requires Go 1.3+ rather than Go 1.1+ * Improve rendering/formatting in some places * Add trailing slash to URLs where appropriate * GitHub redirects all http requests to https, update accordingly
59 lines
1.2 KiB
Markdown
59 lines
1.2 KiB
Markdown
---
|
|
aliases:
|
|
- /doc/redirects/
|
|
- /doc/alias/
|
|
- /doc/aliases/
|
|
date: 2013-07-09
|
|
menu:
|
|
main:
|
|
parent: extras
|
|
next: /extras/builders
|
|
prev: /taxonomies/ordering
|
|
title: Aliases
|
|
weight: 10
|
|
---
|
|
|
|
For people migrating existing published content to Hugo, there's 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**
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>TOML</th><th>YAML</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<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>
|
|
</tbody>
|
|
</table>
|
|
|
|
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
|
|
on your UglyUrls setting. You need to provide absolute path to your webroot and the
|
|
complete filename or directory.*
|
|
|
|
2. *Aliases are rendered prior to any content and will be overwritten by
|
|
any content with the same location.*
|