Skip to content

[bug] wrong condition for (no) generation of social cards #47

@ulu

Description

@ulu

The current implementation in layouts/partials/seo_tags.html generates Social-Card-elements in HTML head-element at any time, independent if "generateSocialCard" is set or unset in hugo.toml. IMHO corrected condition should be:

<!-- Only generate social card if: -->
<!--   - generateSocialCard = true -->
<!--   - there aren't images set in frontmatter -->
<!--   - page is of .Kind "page" -->
-{{ if and (and (default false .Site.Params.generateSocialCard) (not (isset .Params "images"))) (eq .Kind "page") - }}
- {{ partial "social_card.html" . }}
-{{ else }}
+{{ if .Site.Params.generateSocialCard }}
  <!-- Open Graph / Facebook -->
  {{ template "_internal/opengraph.html" . }}

  <!-- Twitter -->
  {{ template "_internal/twitter_cards.html" . }}

  <!-- Microdata -->
  {{ template "_internal/schema.html" . }}
{{ end }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions