Skip to content

Commit

Permalink
hugo: update hugo and go, work around theme issue
Browse files Browse the repository at this point in the history
There's an issue with the upstream theme on Hugo v0.123 that prevents
the site from building.
- lukeorth/poison#169
  • Loading branch information
sudomateo committed Feb 25, 2024
1 parent 912e07b commit 2ce7b86
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.6
FROM golang:1.22.0

# Install curl.
RUN apt-get update && \
Expand All @@ -7,7 +7,7 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Install Hugo.
ENV HUGO_VERSION=0.121.2
ENV HUGO_VERSION=0.123.3
RUN curl -L -o /tmp/hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz && \
tar -xvf /tmp/hugo.tar.gz -C /usr/local/bin hugo && \
rm -rf /tmp/hugo.tar.gz
Expand Down
12 changes: 6 additions & 6 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ title = "Matthew Sanabria"
path = "github.com/lukeorth/poison"

[params]
brand = "Matthew Sanabria"
brand_image = "https://sudomateo.nyc3.digitaloceanspaces.com/images/Matthew-Sanabria-Profile.jpeg"
dark_mode = true
description = "Helping great people become great engineers!"
rss_icon = true
rss_section = ""
brand = "Matthew Sanabria"
dark_mode = true
description = "Helping great people become great engineers!"
remote_brand_image = "https://github.com/sudomateo.png"
rss_icon = true
rss_section = ""

# favicon = ""
# og_image = ""
Expand Down
115 changes: 115 additions & 0 deletions layouts/partials/head/meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{{ .Scratch.Set "title" .Site.Title }}

{{ .Scratch.Set "publisherIcon" .Site.Params.favicon }}
{{ if .Site.Params.publisherIcon }}
{{ .Scratch.Set "publisherIcon" .Site.Params.publisher_icon }}
{{ end }}

{{ if eq .Kind "home" }}
{{ .Scratch.Set "title" $.Site.Params.brand }}
{{ .Scratch.Set "description" .Site.Params.Description }}
{{ else }}
{{ .Scratch.Set "description" .Description }}
{{ end }}

{{ if .IsSection }}
{{ .Scratch.Set "title" ($.Site.Params.brand) }}
{{ .Scratch.Add "title" " - " }}
{{ .Scratch.Add "title" .LinkTitle }}
{{ end }}

{{ if .IsPage }}
{{ .Scratch.Set "title" ($.Site.Params.brand) }}
{{ .Scratch.Add "title" " - " }}
{{ .Scratch.Add "title" .LinkTitle }}
{{ end }}

{{ "<!-- Open Graph image and Twitter Card metadata -->" | safeHTML }}
{{ $image_path := .Params.image | default .Site.Params.og_image -}}
{{ $image_path_local := printf "assets/%s" $image_path -}}
{{ $image_ext := trim (path.Ext $image_path | lower) "." -}}
{{ if fileExists $image_path_local -}}
{{ $image_path:= resources.Get $image_path}}
<meta property="og:image" content="{{ $image_path.RelPermalink }}" />
{{/* If not SVG, read image aspect ratio and define Twitter Card and Open Graph width and height */ -}}
{{ if ne $image_ext "svg" -}}
{{ with (imageConfig $image_path_local) -}}
{{ if (and (gt .Width 144) (gt .Height 144)) -}}
<meta name="twitter:image" content="{{ $image_path.RelPermalink }}"/>
<meta name="twitter:card" content="summary{{ if (and (gt .Width 300) (gt .Height 157) (not (eq .Width .Height))) }}_large_image{{ end }}">
{{ end -}}
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
{{ end -}}
{{ end -}}
<meta property="og:image:type" content="image/{{ if eq $image_ext `svg` }}svg+xml{{ else }}{{ replaceRE `^jpg$` `jpeg` $image_ext }}{{ end }}">
{{ end -}}

<!-- Title Tags -->
<title itemprop="name">{{ .Scratch.Get "title" }}</title>
<meta property="og:title" content={{ .Scratch.Get "title" }} />
<meta name="twitter:title" content={{ .Scratch.Get "title" }} />
<meta itemprop="name" content={{ .Scratch.Get "title" }} />
<meta name="application-name" content={{ .Scratch.Get "title" }} />
<meta property="og:site_name" content="{{ .Site.Title }}" />

<!-- Description Tags -->
<meta name="description" content="{{ .Scratch.Get "description" }}" />
<meta itemprop="description" content="{{ .Scratch.Get "description" }}" />
<meta property="og:description" content="{{ .Scratch.Get "description" }}" />
<meta name="twitter:description" content="{{ .Scratch.Get "description" }}" />

<!-- Link Tags -->
<base href="{{ .Permalink }}" />
<link rel="canonical" href="{{ .Permalink }}" itemprop="url" />
<meta name="url" content="{{ .Permalink }}" />
<meta name="twitter:url" content="{{ .Permalink }}" />
<meta property="og:url" content="{{ .Permalink }}" />

<!-- Date Tags -->
<meta property="og:updated_time" content={{ .Lastmod.Format "2001-02-03T14:05:06Z0700" | safeHTML }} />

<!-- Sitemap & Alternate Outputs -->
<link rel="sitemap" type="application/xml" title="Sitemap" href='{{ "sitemap.xml" | absURL }}' />
{{ range .AlternativeOutputFormats -}}
{{ printf `<link href="%s" rel="%s" type="%s" title="%s" />` .Permalink .Rel .MediaType.Type $.Site.Title | safeHTML }}
{{ end -}}

<!-- Search Engine Crawler Tags -->
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="index,follow" />

<!-- Social Media Tags -->
<meta name="twitter:site" content="{{ .Site.Params.twitter_url }}" />
<meta name="twitter:creator" content="{{ .Site.Params.twitter_url }}" />
<meta property="fb:admins" content="{{ .Site.Params.fb.admins }}" />

<!-- Other Tags -->
<meta name="apple-mobile-web-app-title" content="{{ .Site.Title }}" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

<!-- Article Specific Tags -->
<!-- To make sure this renders only in the article page, we check the section -->
{{ if eq .Section "posts" }}

<meta property="og:type" content="article" />
<meta property="article:publisher" content="{{ .Site.Params.facebook_url }}" />
<meta property="og:article:published_time" content={{ .Date.Format "2001-02-03T14:05:06Z0700" | safeHTML }} />
<meta property="article:published_time" content={{ .Date.Format "2001-02-03T14:05:06Z0700" | safeHTML }} />

{{ with.Params.author }}
<meta property="og:article:author" content="{{humanize . }}" />
<meta property="article:author" content="{{humanize . }}" />
<meta name="author" content="{{humanize . }}" />
{{ end }}

{{ with.Params.category }}
<meta name="news_keywords" content="{{ index . 0 }}" />
<meta property="article:section" content="{{ index . 0 }}" />
{{ end }}

{{ end }}

<!-- Hugo Generator Attribution -->
{{ hugo.Generator }}

0 comments on commit 2ce7b86

Please sign in to comment.