Skip to content

Commit

Permalink
[Docs] Clarify the switch to canonifyurls = false as default
Browse files Browse the repository at this point in the history
Quote from @spf13: "I also think it's the better default
and should continue to be the case going forward."

Also mention the use of `hugo config` to check the current value
of `canonifyurls`, thanks to suggestion by @bep.

Fixes #802
  • Loading branch information
anthonyfok committed Feb 21, 2015
1 parent ac189fd commit 88e7c03
Showing 1 changed file with 8 additions and 47 deletions.
55 changes: 8 additions & 47 deletions docs/content/extras/urls.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,14 @@ Organization](/content/organization/) for more details.

## Canonicalization

<!--
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`.
By setting `canonifyurls` to `false` will prevent this canonicalization.
-->
By default, all relative URLs encountered in the input are left unmodified,
e.g. `/css/foo.css` would stay as `/css/foo.css`.
e.g. `/css/foo.css` would stay as `/css/foo.css`,
i.e. `canonifyurls` defaults to `false`.

By setting `canonifyurls` to `true`, all relative URLs would instead
be *canonicalized* using `baseurl`. For example, assuming you have
`baseurl = http://yoursite.example.com/` defined in the site-wide
config.toml, the relative URL `/css/foo.css` would be turned into
`config.toml`, the relative URL `/css/foo.css` would be turned into
the absolute URL `http://yoursite.example.com/css/foo.css`.

Benefits of canonicalization include fixing all URLs to be absolute, which may
Expand All @@ -56,46 +50,13 @@ 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.

### Caveat: Default of `canonifyurls` changed in v0.11

<table class="table table-bordered">
<thead>
<tr>
<th>Hugo Version</th>
<th>Release Date</th>
<th>Default</th>
</tr>
</thead>
> Note: In the May 2014 release of Hugo v0.11, the default value of `canonifyurls` was switched from `true` to `false`, which we think is the better default and should continue to be the case going forward. So, please verify and adjust your website accordingly if you are upgrading from v0.10 or older versions.
<tbody>
<tr>
<td>v0.9</td>
<td>2013-11-15</td>
<td><code>canonifyurls = true</code> <small>(non-configurable)</small></td>
</tr>
To find out the current value of `canonifyurls` for your website, you may use the handy `hugo config` command added in v0.13:

<tr>
<td>v0.10</td>
<td>2014-03-01</td>
<td><code>canonifyurls = true</code></td>
</tr>
hugo config | grep -i canon

<tr>
<td>v0.11</td>
<td>2014-05-29</td>
<td><code>canonifyurls = false</code></td>
</tr>
Or, if you are on Windows and do not have `grep` installed:

<tr>
<td>v0.12</td>
<td>2014-09-01</td>
<td><code>canonifyurls = false</code></td>
</tr>
hugo config | FINDSTR /I canon

<tr>
<td>v0.13-DEV</td>
<td><small>in development</small></td>
<td><code>canonifyurls = false</code> <small>(as of January 2015)</small></td>
</tr>
</tbody>
</table>

0 comments on commit 88e7c03

Please sign in to comment.