Merge pull request #62 from bugok/tags_meta

Add tags to entry/meta/tags
This commit is contained in:
Vimux 2022-03-20 15:11:17 +03:00 committed by GitHub
commit 8bd2f6f17f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 4 deletions

View file

@ -154,7 +154,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id
hideNoPostsWarning = false # Don't show no posts empty state warning in main page, if true hideNoPostsWarning = false # Don't show no posts empty state warning in main page, if true
[Params.Entry] [Params.Entry]
meta = ["date", "categories"] # Enable meta fields in given order meta = ["date", "categories", "tags"] # Enable meta fields in given order
toc = true # Enable Table of Contents toc = true # Enable Table of Contents
tocOpen = true # Open Table of Contents block. Optional tocOpen = true # Open Table of Contents block. Optional
@ -247,6 +247,7 @@ related: true # Enable/disable Related content for specific page
meta: meta:
- date - date
- categories - categories
- tags
featured: featured:
url: image.jpg # relative path of the image url: image.jpg # relative path of the image
alt: A scale model of the Eiffel tower # alternate text for the image alt: A scale model of the Eiffel tower # alternate text for the image
@ -316,7 +317,7 @@ may activate meta fields with `meta` parameter under the `[Params.Entry]` config
```toml ```toml
[Params.Entry] [Params.Entry]
meta = ["date", "categories"] meta = ["date", "categories", "tags"]
``` ```
#### Related Content #### Related Content

View file

@ -9,6 +9,9 @@
- id: meta_categories - id: meta_categories
translation: "Categories" translation: "Categories"
- id: meta_tags
translation: "Tags"
# Share # Share
- id: share-caption - id: share-caption
translation: "Share on" translation: "Share on"

View file

@ -9,6 +9,9 @@
- id: meta_categories - id: meta_categories
translation: "Catégories" translation: "Catégories"
- id: meta_tags
translation: "Mots-clefs"
# Share # Share
- id: share-caption - id: share-caption
translation: "Partager sur" translation: "Partager sur"

View file

@ -9,6 +9,9 @@
- id: meta_categories - id: meta_categories
translation: "Categorie" translation: "Categorie"
- id: meta_tags
translation: "Tag"
# Share # Share
- id: share-caption - id: share-caption
translation: "Condividi su" translation: "Condividi su"

View file

@ -9,6 +9,9 @@
- id: meta_categories - id: meta_categories
translation: "Categorias" translation: "Categorias"
- id: meta_tags
translation: "Tags"
# Share # Share
- id: share-caption - id: share-caption
translation: "Campartilhar no" translation: "Campartilhar no"

View file

@ -9,6 +9,9 @@
- id: meta_categories - id: meta_categories
translation: "Categorias" translation: "Categorias"
- id: meta_tags
translation: "Tags"
# Share # Share
- id: share-caption - id: share-caption
translation: "Campartilhar" translation: "Campartilhar"

View file

@ -1,5 +1,5 @@
{{- if .Params.categories }} {{- if .Params.categories }}
<span class="entry__meta-categories meta-categories"> <div class="entry__meta-categories meta-categories">
<span class="meta-categories__list">{{ T "meta_categories" }}: <span class="meta-categories__list">{{ T "meta_categories" }}:
{{- range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }} {{- range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}
<a class="meta-categories__link" href="{{ "categories/" | relLangURL }}{{ . | urlize | lower }}/" rel="category"> <a class="meta-categories__link" href="{{ "categories/" | relLangURL }}{{ . | urlize | lower }}/" rel="category">
@ -7,5 +7,5 @@
</a> </a>
{{- end }} {{- end }}
</span> </span>
</span> </div>
{{- end }} {{- end }}

View file

@ -0,0 +1,11 @@
{{- if .Params.tags }}
<div class="entry__meta-tags meta-tags">
<span class="meta-tags__list">{{ T "meta_tags" }}:
{{- range $index, $category := .Params.tags }}{{ if gt $index 0 }}, {{ end }}
<a class="meta-tags__link" href="{{ " tags/" | relLangURL }}{{ . | urlize | lower }}/" rel="tag">
{{- . -}}
</a>
{{- end }}
</span>
</div>
{{- end }}