Check multiple slugs


i would like to show the date of the post for certain slugs, but unfortunately this only works for the first slug. for terms, imprint and privacy the following code does not work.

  {{ if (or (eq .Slug "charta") (eq .Slug "terms") (eq .Slug "imprint") (eq .Slug "privacy")) }}
  <div class="meta text-end">
    <span title="Veröffentlicht"><i class="fas fa-calendar-alt"></i> {{ .Date | time.Format ":date_long" }}</span>
    <span title="Modifiziert"><i class="fas fa-history"></i> {{ .Lastmod | time.Format ":date_long" }}</span>
  {{ end }}

Did you set the slug in front matter for each of the four pages? I’m assuming your content looks like:


Yes I set the slug in the front matter. The structure can be seen here: RollenspielMonster/website: Quellcode der Webseite (created with - website -

charta is not a regular page; it is a section, so it uses


The other three pages are regular pages, so they use


This template does not contain your date code.

1 Like

Thank you, of course you are absolutely right, if I adapt the wrong template it can not work.

1 Like

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