Skip to content

Instantly share code, notes, and snippets.

@jeremyjaymes
Last active March 21, 2021 08:39
Show Gist options
  • Select an option

  • Save jeremyjaymes/403f1cb712d98e8c8a36c904055958d6 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyjaymes/403f1cb712d98e8c8a36c904055958d6 to your computer and use it in GitHub Desktop.

Revisions

  1. jeremyjaymes revised this gist Oct 30, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions hugo_seo.html
    Original file line number Diff line number Diff line change
    @@ -29,9 +29,9 @@
    "name": "{{ .Site.Title }}",
    "author": {
    "@type": "Person",
    "name": "{ .Site.Params.author }}"
    "name": "{{ .Site.Params.author }}"
    },
    "description": "{ .Site.Params.description }}",
    "description": "{{ .Site.Params.description }}",
    }
    </script>
    {{ end }}
  2. jeremyjaymes revised this gist Oct 30, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hugo_seo.html
    Original file line number Diff line number Diff line change
    @@ -63,6 +63,6 @@
    },
    "description": "{ .Site.Params.description }}",
    }
    </script>
    {{ end }}
    </script>
    {{ end }}
  3. jeremyjaymes revised this gist May 18, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion hugo_seo.html
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@
    <meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
    <meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
    <meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />

    <!-- OG data -->
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
    @@ -17,7 +18,8 @@
    <meta property="og:site_name" content="{{ .Site.Title }}" />
    {{ range .Params.categories }}<meta property="article:section" content="{{ . }}" />{{ end }}
    {{ if isset .Params "date" }}<meta property="article:published_time" content="{{ time .Date }}" />{{ end }}


    <!-- JSON-LD -->
    {{ if .IsHome }}
    <script type="application/ld+json">
    {
  4. jeremyjaymes created this gist May 18, 2017.
    66 changes: 66 additions & 0 deletions hugo_seo.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    <meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}"/>
    <meta name="robots" content="noodp"/>
    <link rel="canonical" href="{{ .Permalink }}" />

    <!-- Twitter Card -->
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" />
    <meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
    <meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
    <meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />
    <!-- OG data -->
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
    <meta content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" property="og:title">
    <meta content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" property="og:description">
    <meta property="og:url" content="{{ .Permalink }}" />
    <meta property="og:site_name" content="{{ .Site.Title }}" />
    {{ range .Params.categories }}<meta property="article:section" content="{{ . }}" />{{ end }}
    {{ if isset .Params "date" }}<meta property="article:published_time" content="{{ time .Date }}" />{{ end }}

    {{ if .IsHome }}
    <script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "WebSite",
    "url": "{{ .Permalink }}",
    "name": "{{ .Site.Title }}",
    "author": {
    "@type": "Person",
    "name": "{ .Site.Params.author }}"
    },
    "description": "{ .Site.Params.description }}",
    }
    </script>
    {{ end }}
    {{ if .IsPage }}
    <script type="application/ld+json">
    {{if eq .Section "post"}}
    {
    "@context": "http://schema.org",
    "@type": "BlogPosting",
    "headline": "{{ .Title }}",
    "genre": "{{ range .Params.categories }}{{ . }}{{ end }}",
    "url": "{{ .Permalink }}",
    "datePublished": "{{ time .Date }}",
    "description": "{{ .Description }}",
    "author": {
    "@type": "Person",
    "name": "{{ .Site.Params.author }}"
    }
    }
    {{ else }}
    {
    "@context": "http://schema.org",
    "@type": "WebSite",
    "url": "{{ .Permalink }}",
    "name": "{{ .Title }}",
    "author": {
    "@type": "Person",
    "name": "{ .Site.Params.author }}"
    },
    "description": "{ .Site.Params.description }}",
    }
    </script>
    {{ end }}
    {{ end }}