mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
docs: Fix URLs in examples sites with path prefix
When baseurl ist something like "http://example.com/hugo/" a link to "/tags/..." does not work. Therefore I fixed the examples so that they also work in cases where the website is not saved at the server's root. See also https://discuss.gohugo.io/t/how-shall-i-link-a-taxonomy-page/3920
This commit is contained in:
parent
f914774f6b
commit
de1ca477b8
1 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ each content piece are located in the usual place
|
||||||
|
|
||||||
<ul id="tags">
|
<ul id="tags">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
<li><a href="tags/{{ . | urlize }}">{{ . }}</a> </li>
|
<li><a href="{{ "/tags/" | relURL }}{{ . | urlize }}">{{ . }}</a> </li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ To list such taxonomy use the following:
|
||||||
|
|
||||||
{{ if .Params.directors }}
|
{{ if .Params.directors }}
|
||||||
<strong>Director{{ if gt (len .Params.directors) 1 }}s{{ end }}:</strong>
|
<strong>Director{{ if gt (len .Params.directors) 1 }}s{{ end }}:</strong>
|
||||||
{{ range $index, $director := .Params.directors }}{{ if gt $index 0 }}, {{ end }}<a href="directors/{{ . | urlize }}">{{ . }}</a>{{ end }}
|
{{ range $index, $director := .Params.directors }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/directors/" | relURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
Alternatively, you may use the [delimit]({{< relref "templates/functions.md#delimit" >}})
|
Alternatively, you may use the [delimit]({{< relref "templates/functions.md#delimit" >}})
|
||||||
|
@ -110,7 +110,7 @@ The following example displays all tag keys:
|
||||||
|
|
||||||
<ul id="all-tags">
|
<ul id="all-tags">
|
||||||
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
||||||
<li><a href="/tags/{{ $name | urlize }}">{{ $name }}</a></li>
|
<li><a href="{{ "/tags/" | relURL }}{{ $name | urlize }}">{{ $name }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ This example will list all taxonomies, each of their keys and all the content as
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul>
|
||||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||||
<li><a href="/{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
|
<li><a href="{{ "/" | relURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
|
||||||
<ul>
|
<ul>
|
||||||
{{ range $key, $value := $taxonomy }}
|
{{ range $key, $value := $taxonomy }}
|
||||||
<li> {{ $key }} </li>
|
<li> {{ $key }} </li>
|
||||||
|
|
Loading…
Reference in a new issue