How to get section permalink in a single template


#1

Hi All

Let say I have following content structure like this

Content/
    A_Section
         - foo.md
    B_Section
         - bar.md

What I need is to create permalink on each single content tempate that links to each section where the content is located (A_Section or B_Secion)

Thank You


#2

Try this (untested):

{{ $page := .Site.GetPage .Section }}
<a href="{{ $page.Permalink }}">{{ .Section }}</a>

#3

Sorry for the late reply, the code is working but I’m curious is it possible if disableKinds section is active?


#4

Test it, and let us know


#5

Also:

{{ .CurrentSection.Permalink }}