diff --git a/README.md b/README.md index f58a5e7..c55e188 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,24 @@ Und hier der weitere Artikel Hierfür kann auch die Vorlage für [Blog](https://gitea.marcodn.de/mdn/blogamore/src/branch/main/archetypes/blog.md) verwendet werden. +### Beispiel für eine Beschreibung zur Taxonomy + +Zum erstellen der Datei mit der ein Term in der Taxonomy beschrieben werden kann, wird folgender Befehl verwendet (Taxonomy und Term müssen entsprechend angepasst werden): + +```bash +hugo new tags/tag1/_index.md +``` + +In der Datei kann nun die Beschreibung und der Titel angepasst werden. Sollte man eigene Taxonomies verwenden, wird geraten eine eigene Vorlage zu definieren. Diese ist unte archetypes zu definieren, der Name ist die Pluralform mit ".md" am Ende und es sollte folgenden Inhalt haben: + +```toml +--- +title: {{ $term := path.Base .File.Dir }}"{{ replace $term "-" " " | title }}" +description: "Dies ist eine Beschreibung für {{ $term | title }}" +date: {{ now.Format "2006-01-02" }} +--- +``` + ## Weiteres Haben Sie einen Fehler gefunden oder eine Idee für ein neues Feature? Schicken Sie mir bitte eine Mail an ... Oder erstellen Sie direkt einen [Pull Request](https://gitea.marcodn.de/mdn/blogamore/pulls) diff --git a/archetypes/categories.md b/archetypes/categories.md new file mode 100644 index 0000000..da521ca --- /dev/null +++ b/archetypes/categories.md @@ -0,0 +1,5 @@ +--- +title: {{ $term := path.Base .File.Dir }}"{{ replace $term "-" " " | title }}" +description: "Dies ist eine Beschreibung für {{ $term | title }}" +date: {{ now.Format "2006-01-02" }} +--- diff --git a/archetypes/skills.md b/archetypes/skills.md new file mode 100644 index 0000000..da521ca --- /dev/null +++ b/archetypes/skills.md @@ -0,0 +1,5 @@ +--- +title: {{ $term := path.Base .File.Dir }}"{{ replace $term "-" " " | title }}" +description: "Dies ist eine Beschreibung für {{ $term | title }}" +date: {{ now.Format "2006-01-02" }} +--- diff --git a/archetypes/tags.md b/archetypes/tags.md new file mode 100644 index 0000000..da521ca --- /dev/null +++ b/archetypes/tags.md @@ -0,0 +1,5 @@ +--- +title: {{ $term := path.Base .File.Dir }}"{{ replace $term "-" " " | title }}" +description: "Dies ist eine Beschreibung für {{ $term | title }}" +date: {{ now.Format "2006-01-02" }} +--- diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 1c50987..a2b6dd3 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1 +1,13 @@ -{{- partial "taxonomy/description.html" . -}} \ No newline at end of file +{{/* + Definition der Standardauflistung von Taxonomy und der Seiten eines Elementes der Taxonomy + - kann durch terms.html die Hauptlistung der Taxonomy-Elemente überschrieben werden (z.B. tags/) + - kann durch layout/taxonomy/tag.html die Seite des Elementes überschrieben werden (z.B. tags/64Bit/) + + Um weitere Informationen zu den Taxonomy-Element zu hinterlegen, muss in der Webseite eine _index.md für jedes Element + erzeugt werden. hierfür kann der Befehl `hugo new //_index.md" verwendet werden. Mit unserem Beispiel + würde es dann wie folgt lauten: `hugo new tags/64Bit/index.md`. Sinnvoll sollte dafür auch Vorlagen unter archtypes/.md + sein. Für unser Beispiel wäre es dann archtypes/tags.md. +*/}} +{{ define "main" }} + {{- partial "taxonomy/summary.html" . -}} +{{ end }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..434006b --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,3 @@ +{{ define "main" }} + {{- partial "taxonomy/description.html" . -}} +{{ end }} diff --git a/layouts/partials/taxonomy/description.html b/layouts/partials/taxonomy/description.html index 3157706..e889bff 100644 --- a/layouts/partials/taxonomy/description.html +++ b/layouts/partials/taxonomy/description.html @@ -1,11 +1,9 @@ -{{ define "main" }} -

{{ .Title }}

- {{ range .Pages.ByTitle }} +

{{ .Title }}

+{{ range .Pages.ByTitle }} - {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/taxonomy/summary.html b/layouts/partials/taxonomy/summary.html index 3157706..cfba81a 100644 --- a/layouts/partials/taxonomy/summary.html +++ b/layouts/partials/taxonomy/summary.html @@ -1,11 +1,9 @@ -{{ define "main" }} -

{{ .Title }}

- {{ range .Pages.ByTitle }} +

{{ .Title }}

+{{ range .Pages.ByTitle }} - {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/taxonomy/category.html b/layouts/taxonomy/category.html deleted file mode 100644 index 93e1964..0000000 --- a/layouts/taxonomy/category.html +++ /dev/null @@ -1 +0,0 @@ -{{- partial "taxonomy/summary.html" . -}} \ No newline at end of file diff --git a/layouts/taxonomy/skill.html b/layouts/taxonomy/skill.html deleted file mode 100644 index 93e1964..0000000 --- a/layouts/taxonomy/skill.html +++ /dev/null @@ -1 +0,0 @@ -{{- partial "taxonomy/summary.html" . -}} \ No newline at end of file diff --git a/layouts/taxonomy/tag.html b/layouts/taxonomy/tag.html deleted file mode 100644 index 93e1964..0000000 --- a/layouts/taxonomy/tag.html +++ /dev/null @@ -1 +0,0 @@ -{{- partial "taxonomy/summary.html" . -}} \ No newline at end of file