1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 17:06:37 -04:00

strip any markdown in page titles from meta/social tags in head

This commit is contained in:
2020-08-10 10:58:22 -04:00
parent 9b5a29be7b
commit 0f9de4d350
12 changed files with 40 additions and 33 deletions

View File

@ -1,15 +1,15 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"budparr.language-hugo-vscode",
"bungcip.better-toml",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}

View File

@ -1,6 +1,6 @@
---
title: "Jake Jarvis Front-End Web Developer in Boston, MA"
date: 2020-08-01 17:56:45-0400
title: "Jake Jarvis Front-End Web Developer in Boston, MA 👨‍💻"
date: 2020-08-10 10:17:58-0400
type: home
sitemap:
priority: 1.0

View File

@ -2,7 +2,7 @@
{{- $section := $.Site.GetPage "section" .Section }}
{{- range .Site.AllPages -}}
{{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "description" .Description "kind" .Kind "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "readingtime" .ReadingTime "summary" .Summary "title" .Title "type" .Type "url" .RelPermalink "weight" .Weight "wordcount" .WordCount "section" .Section "tags" .Params.Tags "authors" $.Site.Author.name)}}
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "description" .Description "kind" .Kind "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "readingtime" .ReadingTime "summary" .Summary "title" (.Title | markdownify | htmlUnescape | plainify) "type" .Type "url" .RelPermalink "weight" .Weight "wordcount" .WordCount "section" .Section "tags" .Params.Tags "authors" $.Site.Author.name)}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

View File

@ -1,6 +1,7 @@
<!doctype html>
<html lang="en">
<head>
{{ partial "functions/meta-scratch" . }}
<meta charset="utf-8">
{{ hugo.Generator }}
<script async src="https://cdn.ampproject.org/v0.js"></script>
@ -12,7 +13,7 @@
{{ if .HasShortcode "gist" }}<script async custom-element="amp-gist" src="https://cdn.ampproject.org/v0/amp-gist-0.1.js"></script>{{ end }}
{{ if .HasShortcode "instagram" }}<script async custom-element="amp-instagram" src="https://cdn.ampproject.org/v0/amp-instagram-0.1.js"></script>{{ end }}
{{ if .HasShortcode "vimeo" }}<script async custom-element="amp-vimeo" src="https://cdn.ampproject.org/v0/amp-vimeo-0.1.js"></script>{{ end }}
<title>{{ .Title }}  {{ .Site.Title }}</title>
<title>{{ .Scratch.Get "plainTitle" }}  {{ .Site.Title }}</title>
{{ with .OutputFormats.Get "html" }}<link rel="canonical" href="{{ .Permalink }}">{{ end }}
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}">{{ end }}

View File

@ -1,4 +1,4 @@
{{- $img := partial "functions/social-images" . -}}
{{- $img := partial "functions/meta-scratch" . -}}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ .Site.Title }}</title>
@ -23,7 +23,7 @@
{{- end }}
{{- range (where .Site.RegularPages "Section" .Site.Params.mainSection) }}
<entry>
<title>{{ .Title }}</title>
<title>{{ .Title | markdownify | htmlUnescape | plainify }}</title>
{{- with .Site.Author.name }}
<author>
<name>{{ . }}</name>

View File

@ -1,3 +1,9 @@
{{/* Strip any markdown styling from page title for use in meta tags */}}
{{- with .Title -}}
{{- $.Scratch.Set "plainTitle" (. | markdownify | htmlUnescape | plainify) -}}
{{- end -}}
{{/* Chooses and initializes various images for use by JSON schema & open graph tags */}}
{{/* Author image (default) */}}

View File

@ -1,5 +1,5 @@
{{ partial "functions/meta-scratch" . -}}
{{ partial "head/meta" . -}}
{{ partial "functions/social-images" . -}}
{{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}}
{{ partialCached "head/preload" . -}}

View File

@ -1,6 +1,6 @@
<meta charset="utf-8">
{{ hugo.Generator }}
<title>{{ .Title }}{{ if not .IsHome }}  {{ .Site.Title }}{{ else }} 👨‍💻{{ end }}</title>
<title>{{ .Scratch.Get "plainTitle" }}{{ if not .IsHome }}  {{ .Site.Title }}{{ end }}</title>
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}">{{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -1,4 +1,4 @@
<meta property="og:title" content="{{ .Title }}">
<meta property="og:title" content="{{ .Scratch.Get "plainTitle" }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:type" content="{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}article{{ else }}website{{ end }}">
<meta property="og:locale" content="en_US">
@ -10,7 +10,7 @@
<meta property="og:image:type" content="{{ .MediaType }}">
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
<meta property="og:image:alt" content="{{ $.Title }}">
<meta property="og:image:alt" content="{{ $.Scratch.Get "plainTitle" }}">
{{ end -}}
{{- if and .IsPage (eq .Type .Site.Params.mainSection) }}

View File

@ -4,8 +4,8 @@
"@type": "BlogPosting",
"url": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"mainEntityOfPage": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"name": {{ .Title }},
"headline": {{ .Title }},
"name": {{ .Scratch.Get "plainTitle" }},
"headline": {{ .Scratch.Get "plainTitle" }},
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"dateModified": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"keywords": {{ with .Params.tags }}{{ delimit . ", " }}{{ end }},

View File

@ -1,4 +1,4 @@
{{- $img := partial "functions/social-images" . -}}
{{- $img := partial "functions/meta-scratch" . -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }}</title>
@ -19,7 +19,7 @@
{{ end }}
{{- range (where .Site.RegularPages "Section" .Site.Params.mainSection) }}
<item>
<title>{{ .Title }}</title>
<title>{{ .Title | markdownify | htmlUnescape | plainify }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>{{ end }}

View File

@ -259,9 +259,9 @@
js-tokens "^4.0.0"
"@babel/parser@^7.10.4", "@babel/parser@^7.11.0", "@babel/parser@^7.11.1":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.2.tgz#0882ab8a455df3065ea2dcb4c753b2460a24bead"
integrity sha512-Vuj/+7vLo6l1Vi7uuO+1ngCDNeVmNbTngcJFKCR/oEtz8tKz0CJxZEGmPt9KcIloZhOZ3Zit6xbpXT2MDlS9Vw==
version "7.11.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.3.tgz#9e1eae46738bcd08e23e867bab43e7b95299a8f9"
integrity sha512-REo8xv7+sDxkKvoxEywIdsNFiZLybwdI7hcT5uEPyQrSMB4YQ973BfC9OOrD/81MaIjh6UxdulIQXkjmiH3PcA==
"@babel/plugin-proposal-async-generator-functions@^7.10.4":
version "7.10.5"
@ -2809,9 +2809,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.523:
version "1.3.525"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.525.tgz#bc74080a3fd651b54627ee1fd94972e7c4d38fa8"
integrity sha512-Cni4AhdgdPOH4ZOY0tqgdF+7tF378o4qVRJFq8wxY/asLIVICMAHxfXPfdlivnf6B3Hdg1CI8yuFJ9Wo5kNeSg==
version "1.3.526"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.526.tgz#0e004899edf75afc172cce1b8189aac5dca646aa"
integrity sha512-HiroW5ZbGwgT8kCnoEO8qnGjoTPzJxduvV/Vv/wH63eo2N6Zj3xT5fmmaSPAPUM05iN9/5fIEkIg3owTtV6QZg==
elliptic@^6.5.3:
version "6.5.3"
@ -3671,9 +3671,9 @@ get-stream@^4.0.0:
pump "^3.0.0"
get-stream@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9"
integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==
dependencies:
pump "^3.0.0"
@ -5905,9 +5905,9 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0:
wrappy "1"
onetime@^5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.1.tgz#5c8016847b0d67fcedb7eef254751cfcdc7e9418"
integrity sha512-ZpZpjcJeugQfWsfyQlshVoowIIQ1qBGSVll4rfDq6JJVO//fesjoX808hXWfBjY+ROZgpKDI5TRSRBSoJiZ8eg==
version "5.1.2"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
dependencies:
mimic-fn "^2.1.0"