Update social links
This commit is contained in:
parent
43f4513b98
commit
d89ff14d70
6 changed files with 25 additions and 126 deletions
12
README.md
12
README.md
|
@ -167,6 +167,9 @@ enableRobotsTXT = true
|
|||
# to people with poor eyesight. For more information about color contrast
|
||||
# and accessibility, see https://web.dev/color-and-contrast-accessibility/
|
||||
noClasses = false
|
||||
[markup.goldmark]
|
||||
[markup.goldmark.renderer]
|
||||
unsafe = true
|
||||
|
||||
# Multilingual mode config. More for information about how to setup translation,
|
||||
# see https://gohugo.io/content-management/multilingual/
|
||||
|
@ -224,18 +227,15 @@ enableRobotsTXT = true
|
|||
# information see layouts/partials/social_card.html
|
||||
generateSocialCard = true
|
||||
|
||||
# Social media. Delete any item you aren't using to make sure it won't show up
|
||||
# in your website's metadata.
|
||||
[params.social]
|
||||
twitter = "example" # Twitter handle (without '@')
|
||||
facebook_admin = "0000000000" # Facebook Page Admin ID
|
||||
|
||||
# Author metadata. This is mostly used for the RSS feed of your site, but the
|
||||
# email is also added to the footer of each post. You can hide the "reply to"
|
||||
# link by using a `hideReply` param in front matter.
|
||||
[params.author]
|
||||
name = "John Doe" # Your name as shown in the RSS feed metadata
|
||||
email = "me@example.com" # Added to the footer so readers can reply to posts
|
||||
[params.links]
|
||||
email = "mailto:username@example.com"
|
||||
github = "https://github.com/username"
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
|
BIN
assets/fonts/FiraMono-Bold.ttf
Normal file
BIN
assets/fonts/FiraMono-Bold.ttf
Normal file
Binary file not shown.
|
@ -4,7 +4,7 @@ body {
|
|||
padding: 20px;
|
||||
max-width: 720px;
|
||||
text-align: left;
|
||||
background-color: #1d1f27;
|
||||
background-color: black;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
line-height: 1.5;
|
||||
|
@ -39,6 +39,13 @@ a {
|
|||
font-weight: 400;
|
||||
}
|
||||
|
||||
.title div {
|
||||
color: white;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin: 19.92px 0 19.92px 0;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
@ -153,6 +160,11 @@ p.byline {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
.white-link {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* "Skip to main content" link */
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<small>
|
||||
{{ .Site.Copyright }} | {{ markdownify .Site.Params.madeWith }}
|
||||
</small>
|
||||
{{ .Site.Copyright }} {{ range $title, $link := .Site.Params.links }} | <a rel="me" href="{{ $link }}" class="white-link">{{ title $title }}</a> {{ end }}
|
||||
</small>
|
||||
|
|
|
@ -1,22 +1,5 @@
|
|||
<!-- Primary Meta Tags -->
|
||||
<meta name="title" content="{{ with .Title }}{{ . }}{{ else }}{{ .Site.Title }}{{ end }}" />
|
||||
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||
<meta name="author" content="{{ with .Params.author }}{{ . }}{{ end }}" />
|
||||
<meta name="author" content="{{ .Site.Params.Author.name }}" />
|
||||
<meta name="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
|
||||
|
||||
<!-- 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 }}
|
||||
<!-- Open Graph / Facebook -->
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
|
||||
<!-- Twitter -->
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
||||
<!-- Microdata -->
|
||||
{{ template "_internal/schema.html" . }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<!-- Dynamic social card generation -->
|
||||
{{ $font := resources.GetRemote "https://github.com/google/fonts/raw/main/ofl/firamono/FiraMono-Bold.ttf" }}
|
||||
{{ $font := resources.Get "fonts/FiraMono-Bold.ttf" }}
|
||||
{{ $fg := resources.Get "images/social_card_fg.png"}}
|
||||
{{ $bg := resources.Get "images/social_card_bg.png"}}
|
||||
|
||||
{{ if gt (len .Title) 45 }}
|
||||
{{ if gt (len .Title) 40 }}
|
||||
{{ $fg = $fg.Filter (images.Text .Title (dict
|
||||
"font" $font
|
||||
"color" "#fafafa"
|
||||
|
@ -24,7 +24,7 @@
|
|||
{{ end }}
|
||||
|
||||
{{ $date := .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
|
||||
{{ $author := (default $.Site.Params.author.name ($.Param "author") ) }}
|
||||
{{ $author := (default $.Site.Params.author.name ($.Param "author.name")) }}
|
||||
{{ $byline := (printf "%s | %s" $author $date) }}
|
||||
|
||||
{{ $fg = $fg.Filter (images.Text $byline (dict
|
||||
|
@ -38,99 +38,3 @@
|
|||
|
||||
{{ $card := $bg.Filter (images.Overlay $fg 112 140 ) }}
|
||||
{{ $card := $card.Resize "900x webp q100" }}
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html -->
|
||||
<meta property="og:title" content="{{ .Title }}" />
|
||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
|
||||
<meta property="og:image" content="{{ $card.Permalink | absURL }}"/>
|
||||
|
||||
{{- if .IsPage }}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
||||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
||||
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
|
||||
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
|
||||
{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
|
||||
{{- with .Params.videos }}{{- range . }}
|
||||
<meta property="og:video" content="{{ . | absURL }}" />
|
||||
{{ end }}{{ end }}
|
||||
|
||||
{{- /* If it is part of a series, link to related articles */}}
|
||||
{{- $permalink := .Permalink }}
|
||||
{{- $siteSeries := .Site.Taxonomies.series }}
|
||||
{{- if $siteSeries }}
|
||||
{{ with .Params.series }}{{- range $name := . }}
|
||||
{{- $series := index $siteSeries ($name | urlize) }}
|
||||
{{- range $page := first 6 $series.Pages }}
|
||||
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
|
||||
{{- end }}
|
||||
{{ end }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
|
||||
{{- $facebookAdmin := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $facebookAdmin = .facebook_admin }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.facebook_admin }}
|
||||
{{- $facebookAdmin = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Facebook Page Admin ID for Domain Insights */}}
|
||||
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
|
||||
<!-- Twitter -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/twitter_cards.html -->
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:image" content="{{ $card.Permalink | absURL }}"/>
|
||||
<meta name="twitter:title" content="{{ .Title }}"/>
|
||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
|
||||
|
||||
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
|
||||
{{- $twitterSite := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $twitterSite = .twitter }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.twitter }}
|
||||
{{- $twitterSite = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $twitterSite }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" $twitterSite }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}"/>
|
||||
{{- end }}
|
||||
|
||||
<!-- Microdata -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/schema.html -->
|
||||
<meta itemprop="name" content="{{ .Title }}">
|
||||
<meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
||||
|
||||
{{- if .IsPage -}}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
||||
{{ with .PublishDate }}<meta itemprop="datePublished" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}}
|
||||
{{ with .Lastmod }}<meta itemprop="dateModified" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}}
|
||||
<meta itemprop="wordCount" content="{{ .WordCount }}">
|
||||
|
||||
<meta itemprop="image" content="{{ $card.Permalink | absURL }}"/>
|
||||
|
||||
<!-- Output all taxonomies as schema.org keywords -->
|
||||
<meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue