Hi,
I am in the process of creating a page where it shows the list of posts of a certain tag. I have this code
Tag: {{ .Data.tag }}
I expect this to output the tag name. In my case, it is “Python”.
Tag: Python
However, what I actually get is this
Tag: [{0 0xc2083ef600}]
Any idea what is happening here?
             
            
              
              
              
            
            
           
          
            
              
                bep
                
              
              
                  
                  
              2
              
             
            
              Not sure where you got that syntax. Try this:
<ul>
  {{ range .Site.Taxonomies.tags.python }}
      <li><a href="{{.Page.Url }}">{{.Page.Title }}</a></li>
  {{ end }}
</ul>
             
            
              
              
              
            
            
           
          
            
            
              I think what you are trying to do is listing all links of pages of a certain tag.
I simply want to get the tag of a page. The page that is shown when clicking on a tag link.
             
            
              
              
              
            
            
           
          
            
              
                bep
                
              
              
                  
                  
              4
              
             
            
              There is no “one tag” for a page; a page can have many taxonomies.
So for your case it would be something like
<ul id="tags">
  {{ range .Params.tags }}
    <li><a href="tags/{{ . | urlize }}">{{ . }}</a> </li>
  {{ end }}
</ul>
See
             
            
              
              
              
            
            
           
          
            
            
              I guess I am not making myself clear.
I already have a list of tags. I used the same code as you
Then I click this link
   <li><a href="tags/{{ . | urlize }}">{{ . }}</a> </li>
Naturally, it would take me to a page where the data is filtered by the tag that I clicked.
What I want is to display what that tag is. Doing your code above in that page yielded nothing.
According to the documentation, I should be using
.Data.<singular>
to get that tag. But it’s not working.
             
            
              
              
              
            
            
           
          
            
              
                bep
                
              
              
                  
                  
              6
              
             
            
              OK, I undertand.
“That tag” will get a “list page” - which is a Node.
See:
My guess you are looking for
{{ .Title }}
             
            
              
              
              1 Like
            
            
           
          
            
            
              Sorry for the late reply.
Yes! This is exactly what I was looking for.
Thanks!