-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added support for tags #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
date: 2018-11-29T08:41:44+01:00 | ||
title: Tags | ||
weight: 40 | ||
tags: ["documentation", "tutorial"] | ||
--- | ||
|
||
*Learn theme* support one default taxonomy of gohugo : the *tag* feature. | ||
|
||
## Configuration | ||
|
||
Just add tags to any page : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no space before colons in english. |
||
|
||
```markdown | ||
--- | ||
date: 2018-11-29T08:41:44+01:00 | ||
title: Theme tutorial | ||
weight: 15 | ||
tags: ["tutorial", "theme"] | ||
--- | ||
``` | ||
|
||
## Behavior | ||
|
||
|
||
The tags are displayed at the top of the page, in the order wich they are enterted. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not even sure the use of the verb |
||
|
||
Each tag is a link to a *Taxonomy* page displaying all the articles with the given tag. | ||
|
||
## List all the tags | ||
|
||
In the `config.toml` file you can add a shortcut to display all the tags | ||
|
||
```toml | ||
[[menu.shortcuts]] | ||
name = "<i class='fas fa-tags'></i> Tags" | ||
url = "/tags" | ||
weight = 30 | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
date: 2018-11-29T08:41:44+01:00 | ||
title: Tags | ||
weight: 40 | ||
tags: ["documentation", "tutorial"] | ||
--- | ||
|
||
|
||
Le *thème Learn* supporte une des taxonomy par défaut de GoHugo : les tags. | ||
|
||
## Configuration | ||
|
||
Il suffit d'ajouter un tableau de tags sur la page : | ||
|
||
```markdown | ||
--- | ||
date: 2018-11-29T08:41:44+01:00 | ||
title: Tutoriel pour le thème | ||
weight: 15 | ||
tags: ["tutoriel", "theme"] | ||
--- | ||
``` | ||
|
||
## Comportement | ||
|
||
Les tags sont affichés en haut de la page, dans l'ordre dans lequel ils ont été saisis. | ||
|
||
Chaque tag est un lien vers une page *Taxonomy*, qui affiche tous les article avec ce tag. | ||
|
||
|
||
## Liste des tags | ||
|
||
Il est possible de rajouter un raccourci dans le fichier `config.toml` afin d'afficher une page listant tous les tags | ||
|
||
```toml | ||
[[menu.shortcuts]] | ||
name = "<i class='fas fa-tags'></i> Tags" | ||
url = "/tags" | ||
weight = 30 | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,13 +75,20 @@ | |
</div> | ||
</div> | ||
{{ end }} | ||
|
||
<div id="head-tags"> | ||
{{ partial "tags.html" . }} | ||
</div> | ||
{{ if .Params.chapter }} | ||
<div id="chapter"> | ||
{{ end }} | ||
<div id="body-inner"> | ||
{{if and (not .IsHome) (not .Params.chapter) }} | ||
<h1>{{.Title}}</h1> | ||
<h1> | ||
{{ if eq .Kind "taxonomy" }} | ||
{{.Kind}} : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. English doesn't have spaces before colons. Not sure how to handle this 🤔 . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found no other usage of colons in the theme, except for the title A good solution could be to use the html[lang="fr"] .colon{
padding-left:0.2em;
} But even with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say |
||
{{ end }} | ||
{{.Title}} | ||
</h1> | ||
{{end}} | ||
|
||
{{define "breadcrumb"}} | ||
|
@@ -93,3 +100,4 @@ <h1>{{.Title}}</h1> | |
{{.value|safeHTML}} | ||
{{end}} | ||
{{end}} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="tags"> | ||
{{ if .Params.tags }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this should wrap the |
||
{{range .Params.tags}} | ||
<a class="tag-link" href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }} </a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Useless trailing space? |
||
{{end}} | ||
{{end}} | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* Tags */ | ||
|
||
#head-tags{ | ||
margin-left:1em; | ||
margin-top:1em; | ||
} | ||
|
||
#body .tags a.tag-link { | ||
display: inline-block; | ||
line-height: 2em; | ||
font-size: 0.8em; | ||
position: relative; | ||
margin: 0 16px 8px 0; | ||
padding: 0 10px 0 12px; | ||
background: #8451a1; | ||
|
||
-webkit-border-bottom-right-radius: 3px; | ||
border-bottom-right-radius: 3px; | ||
-webkit-border-top-right-radius: 3px; | ||
border-top-right-radius: 3px; | ||
|
||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.2); | ||
box-shadow: 0 1px 2px rgba(0,0,0,0.2); | ||
color: #fff; | ||
} | ||
|
||
#body .tags a.tag-link:before { | ||
content: ""; | ||
position: absolute; | ||
top:0; | ||
left: -1em; | ||
width: 0; | ||
height: 0; | ||
border-color: transparent #8451a1 transparent transparent; | ||
border-style: solid; | ||
border-width: 1em 1em 1em 0; | ||
} | ||
|
||
#body .tags a.tag-link:after { | ||
content: ""; | ||
position: absolute; | ||
top: 10px; | ||
left: 1px; | ||
width: 5px; | ||
height: 5px; | ||
-webkit-border-radius: 50%; | ||
border-radius: 100%; | ||
background: #fff; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no space before colons in english.