2014-01-03 23:36:53 +00:00
|
|
|
---
|
|
|
|
aliases:
|
2014-05-29 22:42:05 +00:00
|
|
|
- /doc/urls/
|
|
|
|
date: 2014-01-03
|
2014-04-23 07:00:11 +00:00
|
|
|
menu:
|
|
|
|
main:
|
2014-05-29 22:42:05 +00:00
|
|
|
parent: extras
|
|
|
|
next: /community/mailing-list
|
|
|
|
notoc: true
|
|
|
|
prev: /extras/toc
|
|
|
|
title: URLs
|
|
|
|
weight: 70
|
2014-01-03 23:36:53 +00:00
|
|
|
---
|
2014-02-21 00:04:29 +00:00
|
|
|
|
2014-08-31 11:08:36 +00:00
|
|
|
## Pretty URLs
|
2014-02-21 00:04:29 +00:00
|
|
|
|
2014-08-31 11:08:36 +00:00
|
|
|
By default Hugo will create content with 'pretty' URLs. For example
|
2014-02-21 00:04:29 +00:00
|
|
|
content created at /content/extras/urls.md will be rendered at
|
|
|
|
/content/extras/urls/index.html and accessible at /content/extras/urls. No
|
|
|
|
no standard server side configuration is required for these pretty urls to
|
2014-05-27 22:32:57 +00:00
|
|
|
work.
|
2014-02-21 00:04:29 +00:00
|
|
|
|
2014-08-31 11:08:36 +00:00
|
|
|
If you would like to have ugly URLs, you are in luck. Hugo supports the
|
|
|
|
ability to create your entire site with ugly URLs. Simply use the
|
2014-09-17 19:59:18 +00:00
|
|
|
`--uglyUrls=true` flag on the command line.
|
2014-02-21 00:04:29 +00:00
|
|
|
|
2014-08-31 11:08:36 +00:00
|
|
|
If you want a specific piece of content to have an exact URL, you can
|
2014-02-21 00:04:29 +00:00
|
|
|
specify this in the front matter under the url key. See [Content
|
2014-05-09 15:32:06 +00:00
|
|
|
Organization](/content/organization/) for more details.
|
2014-02-21 00:04:29 +00:00
|
|
|
|
|
|
|
## Canonicalization
|
|
|
|
|
2014-01-03 23:36:53 +00:00
|
|
|
By default, all relative URLs encountered in the input will be canonicalized
|
|
|
|
using `baseurl`, so that a link `/css/foo.css` becomes
|
|
|
|
`http://yoursite.example.com/css/foo.css`.
|
|
|
|
|
|
|
|
Setting `canonifyurls` to `false` will prevent this canonicalization.
|
|
|
|
|
|
|
|
Benefits of canonicalization include fixing all URLs to be absolute, which may
|
|
|
|
aid with some parsing tasks. Note though that all real browsers handle this
|
|
|
|
client-side without issues.
|
|
|
|
|
|
|
|
Benefits of non-canonicalization include being able to have resource inclusion
|
|
|
|
be scheme-relative, so that http vs https can be decided based on how this
|
|
|
|
page was retrieved.
|