Can't evaluate field Alphabetical in type interface {}

Surely it is a lazy question and you shall answer “try and see”.

{{ define "main" }}

    <h1>{{ .Title }}</h1>

    {{ $taxonomyObject := .Site.Taxonomies.tags }} 
    {{ range $taxonomyObject.Alphabetical }}
    <p>
    <a class="btn btn-outline-dark font-125" href="{{ .Page.RelPermalink }}">
	    <span class="badge badge-dark">({{ .Count }})</span> {{ .Page.LinkTitle }}
    </a>
    </p>
    {{ end }}

{{ end }}

This code produce a localhost:1313/tags/ where each tag is linked to its ‘tag-name’ page on which there is an alphabetical ordered list of tags.

As I follow this tutorial Make a Hugo Blog From Scratch it is not really what we want, actually the result above in the tags page.

But If I change {{ $taxonomyObject := .Site.Taxonomies.tags }} by {{ $taxonomyObject := .Data.Term.Alphabetical }} an error occurs

ERROR error building site: render: [en v1.0.0 guest] failed to render pages: render of "/tags/life" failed: "/home/pierre/public/hugo-blog/layouts/term.html:11:18": execute of template failed: template: term.html:11:18: executing "main" at <.Data.Term.Alphabetical>: can't evaluate field Alphabetical in type interface {}

Is it because my template is term.html and not taxonomy.html ?

yes :wink:

on a term template:

{{ warnf "site.Taxonomies.tags :: [%T] = %v" site.Taxonomies.tags site.Taxonomies.tags}}
{{ warnf ".Data.Term :: [%T] = %v" .Data.Term .Data.Term}}
WARN  site.Taxonomies.tags :: [page.Taxonomy] = map[blue:[WeightedPage(0,"Post 3")] green:[WeightedPage(0,"Post 3") WeightedPage(0,"Post 2")] red:[WeightedPage(0,"Post 3") WeightedPage(0,"Post 2") WeightedPage(0,"Post 1")]]
WARN  .Data.Term :: [string] = blue
WARN  .Data.Term :: [string] = green
WARN  .Data.Term :: [string] = red

.Data.Term on a term page is a string

whatever is “what you want”