Show categories on a page

I am using Hugo (v. 0.84.3 extended), and I am using the Syna theme.

I would like to display my site’s categories on one page, but I can’t find how to change the Syna theme to do so. On my site, the categories are displayed under the title of my article but when I click on a category word present on my article, it sends me a 404 page.
I would like when visitors click on one of the words in the category, the one returns to a page listing all the articles where are tagged with this word. Do you know how I could do it?
Thank you for your time and your help.

Please post your site configuration file.

Hello,
fter parsing the Syna theme, my problem comes in my opinion on the fragment.html file (attached). I have to modify it in order to integrate the display of categories on another page. Hoping you could tell me what changes I need to make on this file. I have tried everything but without success.
Thanks for your help.


“Fragments.html” file
{{- $page_scratch := .page_scratch -}}
{{- $layout_info := $page_scratch.Get “layout_info” -}}
{{- $page := $layout_info.page -}}
{{- $real_page := $layout_info.real_page -}}
{{- $root := $layout_info.root -}}
{{- $is_404 := $layout_info.is_404 -}}

{{ $default_lang := $real_page.Site.Params.DefaultContentLanguage | default $real_page.Site.Language.Lang }}
{{ $default_site := index (where $real_page.Sites “Language.Lang” “eq” $default_lang) 0 }}
{{ $lang := $real_page.Site.Language.Lang }}

{{- $page_scratch.Set “fragment_directories” (slice) -}}
{{- if eq $is_404 true -}}
{{- $page_scratch.Add “fragment_directories” ($default_site.GetPage “page” “/_global”) -}}
{{- $page_scratch.Add “fragment_directories” ($real_page.Site.GetPage “page” “/_global”) -}}
{{- else -}}

{{- $page_scratch.Set “sections” (slice “/”) -}}
{{- $sections := findRE “[^\/]+” $real_page.CurrentSection.File.Dir -}}
{{- range ($sections | default (slice)) -}}
{{- $page_scratch.Add “sections” . -}}
{{- end -}}
{{- $page_scratch.Add “sections” $real_page -}}

{{- $page_scratch.Set “fragment_directories_tmp” (slice) -}}
{{- range $index, $section := $page_scratch.Get “sections” -}}
{{- $directory := $section -}}
{{- if (eq (add $index 1) (len ($page_scratch.Get “sections”))) -}}
{{- if ne $real_page.Kind “page” -}}

    {{- $page := printf "%s%s" $real_page.File.Dir "_index" -}}
    {{- $page_scratch.Set "active_page_default" ($default_site.GetPage "page" $page) -}}
    {{- $page_scratch.Set "active_page" ($real_page.Site.GetPage "page" $page) -}}
  {{- else if $page -}}
    {{- $page_scratch.Set "active_page_default" $page -}}
    {{- $page_scratch.Set "active_page" $page -}}
  {{- end -}}
{{- else if ge $index 1 -}}
  
  {{- $directory := strings.TrimPrefix "/" (delimit (first (add $index 1) ($page_scratch.Get "sections")) "/") -}}
  {{- $page := printf "%s/%s" $directory "_global" -}}
  {{- $page_scratch.Set "active_page_default" ($default_site.GetPage "page" $page) -}}
  {{- $page_scratch.Set "active_page" ($real_page.Site.GetPage "page" $page) -}}
{{- else -}}
  
  {{- $page := printf "%s/%s" $directory "_global" -}}
  {{- $page_scratch.Set "active_page_default" ($default_site.GetPage "page" $page) -}}
  {{- $page_scratch.Set "active_page" ($real_page.Site.GetPage "page" $page) -}}
{{- end -}}
{{- $page_scratch.Add "fragment_directories_tmp" (dict "directory" ($page_scratch.Get "active_page_default") "index" $index) -}}
{{- $page_scratch.Add "fragment_directories_tmp" (dict "directory" ($page_scratch.Get "active_page") "index" $index) -}}

{{- end -}}

{{- range sort ($page_scratch.Get “fragment_directories_tmp”) “index” “desc” -}}
{{ if .directory }}
{{- $page_scratch.Add “fragment_directories” .directory -}}
{{ end }}
{{- end -}}
{{- end -}}

{{- $page_scratch.Set “fragments” (slice) -}}
{{- $page_scratch.Set “fragments_paths” (slice) -}}
{{- range $directory := ($page_scratch.Get “fragment_directories”) -}}
{{/* Every index.md or [page].md file can be a fragment as well. Even in
_index directories. */}}
{{- $page_scratch.Add “fragments” . -}}

{{- range ($directory.Resources.ByType “page”) -}}
{{- $page_scratch.Add “fragments_paths” (dict “path” .File.Path “resource” .) -}}
{{- end -}}
{{- end -}}

{{- range ($page_scratch.Get “fragments_paths”) -}}
{{- $rel_lang_file_name := printf “%s%s.%s.md” .resource.File.Dir .resource.File.TranslationBaseName $lang -}}
{{- $rel_lang_file := where ($page_scratch.Get “fragments_paths”) “.path” “eq” $rel_lang_file_name -}}
{{- $is_resource_single_language := eq (len $rel_lang_file) 0 -}}
{{- $is_resource_same_language := eq .resource.File.Lang $lang -}}
{{- if and (eq $lang $default_lang) (eq (len (findRE “\.\w{2}\.md” .path)) 0) -}}
{{- $page_scratch.Add “fragments” .resource -}}
{{- else if and (ne $lang $default_lang) (or $is_resource_same_language $is_resource_single_language) -}}
{{- $page_scratch.Add “fragments” .resource -}}
{{- end -}}
{{- end -}}

{{- $page_scratch.Set “page_fragments” (slice) -}}
{{- $page_scratch.Set “page_config” (slice) -}}
{{- $page_scratch.Set “experimentals_used_messages” (slice) -}}
{{- $page_scratch.Set “fragments_directory_name” (slice) -}}
{{- if $page_scratch.Get “fragments” -}}
{{- range ($page_scratch.Get “fragments”) -}}
{{- $name := replace .Name “/index” “” -}}
{{- if ne $root.File nil -}}
{{- $directory_same_name := in ($page_scratch.Get “fragments_directory_name”) (printf “%s%s/” $root.File.Dir (replace $name “.md” “”)) -}}
{{- if and (not .Params.disabled) (isset .Params “fragment”) (not $directory_same_name) -}}
{{- if or $is_404 (ne .Params.fragment “404”) -}}
{{- if and (eq .Params.fragment “config”) (not (where ($page_scratch.Get “page_config”) “.Name” $name)) (ne .Params.hide) -}}
{{- $page_scratch.Add “page_config” . -}}
{{- else if not (where ($page_scratch.Get “page_fragments”) “.Name” $name) -}}
{{- $page_scratch.Add “page_fragments” . -}}
{{- $page_scratch.Add “fragments_directory_name” (printf “%s%s/” $root.File.Dir (replace $name “.md” “”)) -}}
{{- if isset .Params “padding” -}}
{{- $page_scratch.Add “experimentals_used_messages” “FrontMatter variable ‘padding’ is experimental and may get removed without notice” -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- $page_scratch.Set “js” (slice (dict “file” “syna-main.js”)) -}}

{{- $page_scratch.Set “react” false -}}

{{- $page_scratch.Set “page_slots” (slice) -}}

{{- partial “helpers/deprecation-warning.html” (dict “Site” $real_page.Site “page_scratch” $page_scratch) -}}

“Categories.html” file

{{ .Date.Format "Jan 2, 2006" }} {{ if .Site.DisqusShortname }} - Comments{{ end }}

{{ range $idx, $category := .categories }}
{{- if ne $idx 0 }}, {{ end }}<a href="{{ "categories/" | relURL }}{{ $category | urlize }}">{{ $category }}</a>

{{- end }}

---

Please take this up with the theme author:

https://github.com/okkur/syna/issues/828

Hello,
Hello, Attached is the complete configuration file for my site. Thank you for your help in unblocking the situation.

syna.zip
Cordially

I have carried out the procedure described in the link transmitted (https://github.com/okkur/syna/issues/828). The categories appear, I modified the categories.html file to activate the url link on the terms of the categories. For example, I have the word “Hugo 'which is tagged in the category section of my page. When I click on” Hugo ", a page opens on the url http: //…/categorie/Hugo with a 404 message while I would like the item listing where the term “Hugo” is referenced.

Please read this again, carefully…
https://github.com/okkur/syna/issues/828

Syna doesn’t yet support taxonomies.

Thanks you.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.