mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 00:16:45 +00:00
Added missing / in URL generator (#1946)
* Added missing `/` in URL generator
In the example to render tags and topics, we use:
```html
<a href="{{ "tags" | absURL }}{{ . | urlize }}">
```
But this will produce links like `www.example.com/tagsTerm` where `Term` is a tag. So added the missing `/`.
* Updated the tags and topics listing code
The example previously used the old `with .Params.tags` style. Updated it to use `.GetTerms "tags"` style.
This commit is contained in:
1 parent
3a22ee7d6e
commit
f9d6445c4d
1 file changed
+15
-14
@@ -6,7 +6,7 @@ date: 2017-02-01
|
|||||||
publishdate: 2017-02-01
|
publishdate: 2017-02-01
|
||||||
lastmod: 2017-04-06
|
lastmod: 2017-04-06
|
||||||
categories: [templates]
|
categories: [templates]
|
||||||
keywords: [page,templates]
|
keywords: [page, templates]
|
||||||
menu:
|
menu:
|
||||||
docs:
|
docs:
|
||||||
parent: "templates"
|
parent: "templates"
|
||||||
@@ -32,6 +32,7 @@ This single page template makes use of Hugo [base templates], the [`.Format` fun
|
|||||||
|
|
||||||
{{< code file="layouts/posts/single.html" download="single.html" >}}
|
{{< code file="layouts/posts/single.html" download="single.html" >}}
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
|
||||||
<section id="main">
|
<section id="main">
|
||||||
<h1 id="title">{{ .Title }}</h1>
|
<h1 id="title">{{ .Title }}</h1>
|
||||||
<div>
|
<div>
|
||||||
@@ -46,20 +47,20 @@ This single page template makes use of Hugo [base templates], the [`.Format` fun
|
|||||||
<h4 id="date"> {{ .Date.Format "Mon Jan 2, 2006" }} </h4>
|
<h4 id="date"> {{ .Date.Format "Mon Jan 2, 2006" }} </h4>
|
||||||
<h5 id="wordcount"> {{ .WordCount }} Words </h5>
|
<h5 id="wordcount"> {{ .WordCount }} Words </h5>
|
||||||
</section>
|
</section>
|
||||||
{{ with .Params.topics }}
|
{{ with .GetTerms "topics" }}
|
||||||
<ul id="topics">
|
<ul id="topics">
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
<li><a href="{{ "topics" | absURL}}{{ . | urlize }}">{{ . }}</a> </li>
|
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
{{ with .GetTerms "tags" }}
|
||||||
{{ end }}
|
<ul id="tags">
|
||||||
{{ with .Params.tags }}
|
{{ range . }}
|
||||||
<ul id="tags">
|
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||||
{{ range . }}
|
{{ end }}
|
||||||
<li> <a href="{{ "tags" | absURL }}{{ . | urlize }}">{{ . }}</a> </li>
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ with .PrevInSection }}
|
{{ with .PrevInSection }}
|
||||||
@@ -81,7 +82,7 @@ To easily generate new instances of a content type (e.g., new `.md` files in a s
|
|||||||
[content type]: /content-management/types/
|
[content type]: /content-management/types/
|
||||||
[directory structure]: /getting-started/directory-structure/
|
[directory structure]: /getting-started/directory-structure/
|
||||||
[dry]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
|
[dry]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
|
||||||
[`.Format` function]: /functions/format/
|
[`.format` function]: /functions/format/
|
||||||
[front matter]: /content-management/front-matter/
|
[front matter]: /content-management/front-matter/
|
||||||
[pagetaxonomy]: /templates/taxonomy-templates/#display-a-single-piece-of-contents-taxonomies
|
[pagetaxonomy]: /templates/taxonomy-templates/#display-a-single-piece-of-contents-taxonomies
|
||||||
[pagevars]: /variables/page/
|
[pagevars]: /variables/page/
|
||||||
|
|||||||
Reference in new issue
Block a user