Skip to content

Commit f4ea6a1

Browse files
authored
[UG] Taxonomy page copyedited & prettified (#2229)
1 parent c2e4beb commit f4ea6a1

File tree

2 files changed

+161
-44
lines changed

2 files changed

+161
-44
lines changed

userguide/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
!/content/en/docs/adding-content/search.md
1515

1616
!/content/en/docs/adding-content/lookandfeel.md
17+
!/content/en/docs/adding-content/taxonomy.md
1718

1819
!/static

userguide/content/en/docs/adding-content/taxonomy.md

Lines changed: 160 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,70 @@
11
---
2-
title: "Taxonomy Support"
3-
linkTitle: "Taxonomy Support"
2+
title: Taxonomy Support
43
weight: 10
5-
tags: ["Tagging", "Structuring Content", "Labelling"]
6-
categories: ["Taxonomies"]
4+
tags: [Tagging, Structuring Content, Labelling]
5+
categories: [Taxonomies]
76
description: >
87
Structure the content using taxonomies like tags, categories, labels.
8+
cSpell:ignore: taxo
99
---
1010

11-
Docsy supports Hugo's Taxonomies (see: https://gohugo.io/content-management/taxonomies/) in its docs and blog section. You can see the default layout and can test the behavior of the generated links on this page.
11+
Docsy supports Hugo [taxonomies] in its docs and blog section. You can see the
12+
default layout and can test the behavior of the generated links on this page.
1213

1314
## Terminology
1415

15-
To understand the usage of taxonomies you should understand the following terminology:
16+
To understand the usage of taxonomies you should understand the following
17+
terminology:
1618

17-
Taxonomy
18-
: a categorization that can be used to classify content - e.g.: Tags, Categories, Projects, People
19+
- **Taxonomy**: a categorization that can be used to classify content - e.g.:
20+
Tags, Categories, Projects, People
1921

20-
Term
21-
: a key within the taxonomy - e.g. within projects: Project A, Project B
22+
- **Term**: a key within the taxonomy - e.g. within projects: Project A, Project
23+
B
2224

23-
Value
24-
: a piece of content assigned to a term - e.g. a page of your site, that belongs to a specific project
25+
- **Value**: a piece of content assigned to a term - e.g. a page of your site,
26+
that belongs to a specific project
2527

26-
A example taxonomy for a movie website you can find in the official Hugo docs: https://gohugo.io/content-management/taxonomies/#example-taxonomy-movie-website
28+
A [movie-website sample][] taxonomy is provided by the Hugo docs.
2729

28-
## Parameters
30+
[movie-website sample]:
31+
https://gohugo.io/content-management/taxonomies/#example-taxonomy-movie-website
2932

30-
There are various parameter to control the functionality of taxonomies in the project [configuration file].
33+
## Parameters
3134

32-
By default taxonomies for `tags` and `categories` are enabled in Hugo (see: https://gohugo.io/content-management/taxonomies/#default-destinations). In Docsy taxonomies can be __disabled__ in the `hugo.toml`/`hugo.yaml`/`hugo.json`:
35+
There are various parameter to control the functionality of taxonomies in the
36+
project [configuration file][]. Taxonomies are [enabled by default][] for `tags`
37+
and `categories` in Hugo. To **disable** taxonomies, add the following to your
38+
project config:
3339

40+
<!-- prettier-ignore-start -->
3441
{{< tabpane >}}
3542
{{< tab header="Configuration file:" disabled=true />}}
3643
{{< tab header="hugo.toml" lang="toml" >}}
3744
disableKinds = ["taxonomy"]
3845
{{< /tab >}}
3946
{{< tab header="hugo.yaml" lang="yaml" >}}
40-
disableKinds:
41-
- taxonomy
47+
disableKinds: [taxonomy]
4248
{{< /tab >}}
4349
{{< tab header="hugo.json" lang="json" >}}
4450
{
4551
"disableKinds": [ "taxonomy" ]
4652
}
4753
{{< /tab >}}
4854
{{< /tabpane >}}
55+
<!-- prettier-ignore-end -->
4956

50-
If you want to enable taxonomies in Docsy make sure you have deleted (or commented out) this line in your project's `hugo.toml`/`hugo.yaml`/`hugo.json`. Then the taxonomy pages for `tags` and `categories` will be generated by Hugo. If you want to use other taxonomies you have to define them in your [configuration file]. If you want to use beside your own taxonomies also the default taxonomies `tags` and `categories`, you also have to define them beside your own taxonomies. You need to provide both the plural and singular labels for each taxonomy.
57+
Then the taxonomy pages for `tags` and `categories` will be generated by Hugo.
58+
If you want to use other taxonomies you have to define them in your
59+
[configuration file]. If you want to use beside your own taxonomies also the
60+
default taxonomies `tags` and `categories`, you also have to define them beside
61+
your own taxonomies. You need to provide both the plural and singular labels for
62+
each taxonomy.
5163

52-
With the following example you define a additional taxonomy `projects` beside the default taxonomies `tags` and `categories`:
64+
With the following example you define a additional taxonomy `projects` beside
65+
the default taxonomies `tags` and `categories`:
5366

67+
<!-- prettier-ignore-start -->
5468
{{< tabpane >}}
5569
{{< tab header="Configuration file:" disabled=true />}}
5670
{{< tab header="hugo.toml" lang="toml" >}}
@@ -75,9 +89,13 @@ taxonomies:
7589
}
7690
{{< /tab >}}
7791
{{< /tabpane >}}
92+
<!-- prettier-ignore-end -->
7893

79-
You can use the following parameters in your project's `hugo.toml`/`hugo.yaml`/`hugo.json` to control the output of the assigned taxonomy terms for each article resp. page of your docs and/or blog section in Docsy or a "tag cloud" in Docsy's right sidebar:
94+
You can use the following parameters in your project's config to control the
95+
output of the assigned taxonomy terms for each article resp. page of your docs
96+
and/or blog section in Docsy or a "tag cloud" in Docsy's right sidebar:
8097

98+
<!-- prettier-ignore-start -->
8199
{{< tabpane >}}
82100
{{< tab header="Configuration file:" disabled=true />}}
83101
{{< tab header="hugo.toml" lang="toml" >}}
@@ -120,23 +138,38 @@ params:
120138
}
121139
{{< /tab >}}
122140
{{< /tabpane >}}
141+
<!-- prettier-ignore-end -->
142+
143+
The settings above would only show a taxonomy cloud for `projects` and `tags`
144+
(with the headlines "Our Projects" and "Tag Cloud") in Docsy's right sidebar and
145+
the assigned terms for the taxonomies `tags` and `categories` for each page.
123146

124-
The settings above would only show a taxonomy cloud for `projects` and `tags` (with the headlines "Our Projects" and "Tag Cloud") in Docsy's right sidebar and the assigned terms for the taxonomies `tags` and `categories` for each page.
147+
To disable any taxonomy cloud you have to set the Parameter `taxonomyCloud = []`
148+
resp. if you don't want to show the assigned terms you have to set
149+
`taxonomyPageHeader = []`.
125150

126-
To disable any taxonomy cloud you have to set the Parameter `taxonomyCloud = []` resp. if you don't want to show the assigned terms you have to set `taxonomyPageHeader = []`.
151+
As default the plural label of a taxonomy is used as it cloud title. You can
152+
overwrite the default cloud title with `taxonomyCloudTitle`. But if you do so,
153+
you have to define a manual title for each enabled taxonomy cloud
154+
(`taxonomyCloud` and `taxonomyCloudTitle` must have the same length!).
127155

128-
As default the plural label of a taxonomy is used as it cloud title. You can overwrite the default cloud title with `taxonomyCloudTitle`. But if you do so, you have to define a manual title for each enabled taxonomy cloud (`taxonomyCloud` and `taxonomyCloudTitle` must have the same length!).
156+
If you don't set the parameters `taxonomyCloud` resp. `taxonomyPageHeader` the
157+
taxonomy clouds resp. assigned terms for all defined taxonomies will be
158+
generated.
129159

130-
If you don't set the parameters `taxonomyCloud` resp. `taxonomyPageHeader` the taxonomy clouds resp. assigned terms for all defined taxonomies will be generated.
131160
## Partials
132161

133-
The by default used partials for displaying taxonomies are so defined, that you should be able to use them also easily in your own layouts.
162+
The by default used partials for displaying taxonomies are so defined, that you
163+
should be able to use them also easily in your own layouts.
134164

135165
### taxonomy_terms_article
136166

137-
The partial `taxonomy_terms_article` shows all assigned terms of an given taxonomy (partial parameter `taxo`) of an article respectively page (partial parameter `context`, most of the time the current page or context `.`).
167+
The partial `taxonomy_terms_article` shows all assigned terms of an given
168+
taxonomy (partial parameter `taxo`) of an article respectively page (partial
169+
parameter `context`, most of the time the current page or context `.`).
138170

139-
Example usage in `layouts/docs/list.html` for the header of each page in the docs section:
171+
Example usage in `layouts/docs/list.html` for the header of each page in the
172+
docs section:
140173

141174
```go-html-template
142175
{{ $context := . }}
@@ -145,33 +178,72 @@ Example usage in `layouts/docs/list.html` for the header of each page in the doc
145178
{{ end }}
146179
```
147180

148-
This will gave you for each in the current page (resp. context) defined taxonomy a list with all assigned terms:
181+
This will gave you for each in the current page (resp. context) defined taxonomy
182+
a list with all assigned terms:
183+
149184
```html
150185
<div class="taxonomy taxonomy-terms-article taxo-categories">
151186
<h5 class="taxonomy-title">Categories:</h5>
152187
<ul class="taxonomy-terms">
153-
<li><a class="taxonomy-term" href="//localhost:1313/categories/taxonomies/" data-taxonomy-term="taxonomies"><span class="taxonomy-label">Taxonomies</span></a></li>
188+
<li>
189+
<a
190+
class="taxonomy-term"
191+
href="//localhost:1313/categories/taxonomies/"
192+
data-taxonomy-term="taxonomies"
193+
><span class="taxonomy-label">Taxonomies</span></a
194+
>
195+
</li>
154196
</ul>
155197
</div>
156198
<div class="taxonomy taxonomy-terms-article taxo-tags">
157199
<h5 class="taxonomy-title">Tags:</h5>
158200
<ul class="taxonomy-terms">
159-
<li><a class="taxonomy-term" href="//localhost:1313/tags/tagging/" data-taxonomy-term="tagging"><span class="taxonomy-label">Tagging</span></a></li>
160-
<li><a class="taxonomy-term" href="//localhost:1313/tags/structuring-content/" data-taxonomy-term="structuring-content"><span class="taxonomy-label">Structuring Content</span></a></li>
161-
<li><a class="taxonomy-term" href="//localhost:1313/tags/labelling/" data-taxonomy-term="labelling"><span class="taxonomy-label">Labelling</span></a></li>
201+
<li>
202+
<a
203+
class="taxonomy-term"
204+
href="//localhost:1313/tags/tagging/"
205+
data-taxonomy-term="tagging"
206+
><span class="taxonomy-label">Tagging</span></a
207+
>
208+
</li>
209+
<li>
210+
<a
211+
class="taxonomy-term"
212+
href="//localhost:1313/tags/structuring-content/"
213+
data-taxonomy-term="structuring-content"
214+
><span class="taxonomy-label">Structuring Content</span></a
215+
>
216+
</li>
217+
<li>
218+
<a
219+
class="taxonomy-term"
220+
href="//localhost:1313/tags/labelling/"
221+
data-taxonomy-term="labelling"
222+
><span class="taxonomy-label">Labelling</span></a
223+
>
224+
</li>
162225
</ul>
163226
</div>
164227
```
165228

166229
### taxonomy_terms_article_wrapper
167230

168-
The partial `taxonomy_terms_article_wrapper` is a wrapper for the partial `taxonomy_terms_article` with the only parameter `context` (most of the time the current page or context `.`) and checks the taxonomy parameters of your project's `hugo.toml`/`hugo.yaml`/`hugo.json` to loop threw all listed taxonomies in the parameter `taxonomyPageHeader` resp. all defined taxonomies of your page, if `taxonomyPageHeader` isn't set.
231+
The partial `taxonomy_terms_article_wrapper` is a wrapper for the partial
232+
`taxonomy_terms_article` with the only parameter `context` (most of the time the
233+
current page or context `.`) and checks the taxonomy parameters of your
234+
project's `hugo.toml`/`hugo.yaml`/`hugo.json` to loop threw all listed
235+
taxonomies in the parameter `taxonomyPageHeader` resp. all defined taxonomies of
236+
your page, if `taxonomyPageHeader` isn't set.
169237

170238
### taxonomy_terms_cloud
171239

172-
The partial `taxonomy_terms_cloud` shows all used terms of an given taxonomy (partial parameter `taxo`) for your site (partial parameter `context`, most of the time the current page or context `.`) and with the parameter `title` as headline.
240+
The partial `taxonomy_terms_cloud` shows all used terms of an given taxonomy
241+
(partial parameter `taxo`) for your site (partial parameter `context`, most of
242+
the time the current page or context `.`) and with the parameter `title` as
243+
headline.
173244

174-
Example usage in partial `taxonomy_terms_clouds` for showing all defined taxonomies and its terms:
245+
Example usage in partial `taxonomy_terms_clouds` for showing all defined
246+
taxonomies and its terms:
175247

176248
```go-html-template
177249
{{ $context := . }}
@@ -180,25 +252,69 @@ Example usage in partial `taxonomy_terms_clouds` for showing all defined taxonom
180252
{{ end }}
181253
```
182254

183-
As an example this will gave you for following HTML markup for the taxonomy `categories`:
255+
This will give you the following HTML markup for the taxonomy `categories`:
256+
184257
```html
185258
<div class="taxonomy taxonomy-terms-cloud taxo-categories">
186259
<h5 class="taxonomy-title">Cloud of Categories</h5>
187260
<ul class="taxonomy-terms">
188-
<li><a class="taxonomy-term" href="//localhost:1313/categories/category-1/" data-taxonomy-term="category-1"><span class="taxonomy-label">category 1</span><span class="taxonomy-count">3</span></a></li>
189-
<li><a class="taxonomy-term" href="//localhost:1313/categories/category-2/" data-taxonomy-term="category-2"><span class="taxonomy-label">category 2</span><span class="taxonomy-count">1</span></a></li>
190-
<li><a class="taxonomy-term" href="//localhost:1313/categories/category-3/" data-taxonomy-term="category-3"><span class="taxonomy-label">category 3</span><span class="taxonomy-count">2</span></a></li>
191-
<li><a class="taxonomy-term" href="//localhost:1313/categories/category-4/" data-taxonomy-term="category-4"><span class="taxonomy-label">category 4</span><span class="taxonomy-count">6</span></a></li>
261+
<li>
262+
<a
263+
class="taxonomy-term"
264+
href="//localhost:1313/categories/category-1/"
265+
data-taxonomy-term="category-1"
266+
><span class="taxonomy-label">category 1</span
267+
><span class="taxonomy-count">3</span></a
268+
>
269+
</li>
270+
<li>
271+
<a
272+
class="taxonomy-term"
273+
href="//localhost:1313/categories/category-2/"
274+
data-taxonomy-term="category-2"
275+
><span class="taxonomy-label">category 2</span
276+
><span class="taxonomy-count">1</span></a
277+
>
278+
</li>
279+
<li>
280+
<a
281+
class="taxonomy-term"
282+
href="//localhost:1313/categories/category-3/"
283+
data-taxonomy-term="category-3"
284+
><span class="taxonomy-label">category 3</span
285+
><span class="taxonomy-count">2</span></a
286+
>
287+
</li>
288+
<li>
289+
<a
290+
class="taxonomy-term"
291+
href="//localhost:1313/categories/category-4/"
292+
data-taxonomy-term="category-4"
293+
><span class="taxonomy-label">category 4</span
294+
><span class="taxonomy-count">6</span></a
295+
>
296+
</li>
192297
</ul>
193298
</div>
194299
```
195300

196301
### taxonomy_terms_clouds
197302

198-
The partial `taxonomy_terms_clouds` is a wrapper for the partial `taxonomy_terms_cloud` with the only parameter `context` (most of the time the current page or context `.`) and checks the taxonomy parameters of your project's `hugo.toml`/`hugo.yaml`/`hugo.json` to loop threw all listed taxonomies in the parameter `taxonomyCloud` resp. all defined taxonomies of your page, if `taxonomyCloud` isn't set.
303+
The partial `taxonomy_terms_clouds` is a wrapper for the partial
304+
`taxonomy_terms_cloud` with the only parameter `context` (most of the time the
305+
current page or context `.`) and checks the taxonomy parameters of your
306+
project's config to loop threw all listed taxonomies in the parameter
307+
`taxonomyCloud` resp. all defined taxonomies of your page, if `taxonomyCloud`
308+
isn't set.
199309

200310
## Multi language support for taxonomies
201311

202-
The taxonomy terms associated content gets only counted and linked WITHIN the language! The control parameters for the taxonomy support can also get assigned language specific.
312+
For [multilingual sites][], taxonomy terms get counted and linked _within_ the
313+
language site only. Taxonomy config parameters can be adjusted per language.
203314

204-
[configuration file]: https://gohugo.io/getting-started/configuration/#configuration-file
315+
[configuration file]:
316+
https://gohugo.io/getting-started/configuration/#configuration-file
317+
[enabled by default]:
318+
https://gohugo.io/content-management/taxonomies/#default-destinations
319+
[multilingual sites]: https://gohugo.io/configuration/params/#multilingual-sites
320+
[taxonomies]: https://gohugo.io/content-management/taxonomies/

0 commit comments

Comments
 (0)