1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 15:48:31 -04:00

organize config.toml params, and stop treating frontmattered CSS as SCSS unnecessarily -- it appears to cause some weird race condition with temporary files every once in a while...? not the intended use anyways though.

This commit is contained in:
Jake Jarvis 2020-07-12 19:51:19 -04:00
parent 9bf2d2e36b
commit 5123b8831a
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
15 changed files with 60 additions and 60 deletions

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -18,7 +18,7 @@
// which class is <body> set to initially?
// eslint-disable-next-line
var default_theme = "{{ .Site.Params.defaultTheme }}";
var default_theme = "{{ .Site.Params.Theme.defaultTheme }}";
// use an element with class `dark-mode-toggle` to trigger swap when clicked
var toggle = doc.querySelector(".dark-mode-toggle");

View File

@ -2,7 +2,7 @@
// NOTE: all variables set by Hugo's config.toml MUST go here:
// prettier-ignore
$max-width: "{{ printf "%d%s" .Site.Params.maxWidth "px" }}";
$max-width: "{{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }}";
$base-url: "{{ strings.TrimRight "/" .Site.BaseURL }}" + "/";
// those values need quotes because, even though prettier & stylelint are correct

View File

@ -24,32 +24,35 @@ disableAliases = true
[params]
description = "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps."
image = "img/logo.png" # must be in assetDir
mainSection = "notes" # reflected in RSS, Atom, AMP
defaultTheme = "light" # "light" or "dark" theme
maxWidth = 940 # px
githubRepo = "jakejarvis/jarv.is"
facebookAppID = 3357248167622283
webmentionIO = "jarv.is" # webmention.io username
copyrightFirstYear = 2001
license = "CC-BY-4.0"
licenseFull = "Creative Commons Attribution 4.0 International"
image = "img/logo.png" # relative to assetDir root
mainSection = "notes" # content that appears in feeds
[params.social]
githubRepo = "jakejarvis/jarv.is" # user/repo
webmentionIO = "jarv.is" # webmention.io username
facebookAppID = 3357248167622283
[params.license]
name = "CC-BY-4.0"
nameLong = "Creative Commons Attribution 4.0 International"
copyrightFirstYear = 2001
[params.theme]
maxWidth = 940 # px
defaultTheme = "light" # light or dark?
[author]
name = "Jake Jarvis"
image = "img/me_large.jpg" # must be in assetDir
jobTitle = "Front-End Web Developer"
image = "img/me_large.jpg" # relative to assetDir root
email = "jake@jarv.is"
github = "jakejarvis"
keybase = "jakejarvis"
twitter = "jakejarvis"
twitterID = 229769022
medium = "jakejarvis"
linkedin = "jakejarvis"
facebook = "jakejarvis"
facebookID = 1329090853
instagram = "jakejarvis"
mastodon = "mastodon.social/@jakejarvis"
[author.social]
github = "jakejarvis"
keybase = "jakejarvis"
twitter = "jakejarvis"
twitterID = 229769022
medium = "jakejarvis"
linkedin = "jakejarvis"
facebook = "jakejarvis"
facebookID = 1329090853
instagram = "jakejarvis"
mastodon = "mastodon.social/@jakejarvis"
[module]
[[module.imports]]

View File

@ -42,15 +42,13 @@ css: |
div#content span.limegreen {
color: #32cd32;
}
header nav {
a#logo h1#name {
font-size: 1.5em;
line-height: 1.15;
}
ul li a span.text {
font-size: 0.9em;
line-height: 1.15;
}
header nav a#logo h1#name {
font-size: 1.5em;
line-height: 1.15;
}
header nav ul li a span.text {
font-size: 0.9em;
line-height: 1.15;
}
footer div#copyright, footer div#poweredby {
font-size: 1.1em;

View File

@ -6,7 +6,7 @@
<head>
{{ partial "head/_head" . }}
</head>
<body class="{{ .Page.Kind }} {{ .Site.Params.defaultTheme }}">
<body class="{{ .Page.Kind }} {{ .Site.Params.Theme.defaultTheme }}">
{{ partialCached "page/header" . }}
<main>
{{ block "main" . }}{{ end }}

View File

@ -90,7 +90,7 @@
padding-left: 1em;
}
article {
max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
margin: 0 auto;
padding: 0 15px;
line-height: 1.75;
@ -147,7 +147,7 @@
text-decoration: none;
}
nav {
max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
margin: 0 auto;
padding: 0 15px;
display: flex;
@ -198,7 +198,7 @@
}
footer div.row {
width: 100%;
max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
max-width: {{ printf "%d%s" .Site.Params.Theme.maxWidth "px" }};
margin: 0 auto;
display: flex;
justify-content: space-between;
@ -290,7 +290,7 @@
<footer>
<div class="row">
<div class="left">Content by <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>, licensed under <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>{{ .Site.Params.license }}</a>.</div>
<div class="left">Content by <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>, licensed under <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.license.nameLong }} title="{{ . }}"{{ end }}>{{ .Site.Params.license.name }}</a>.</div>
<div class="right"><a class="back-to-top" href="#top">↑ Back to top.</a></div>
</div>
</footer>

View File

@ -3,7 +3,7 @@
{{ $original := .Page.Resources.GetMatch (.Get "src") }}
{{ .Scratch.Set "image" $original }}
{{ $setWidth := .Site.Params.maxWidth }}
{{ $setWidth := .Site.Params.Theme.maxWidth }}
{{ if .Get "width" }}
{{ $setWidth = (int (.Get "width")) }}

View File

@ -9,7 +9,7 @@
<link rel="author" href="{{ "humans.txt" | absURL }}">
{{/* if this is a page/post, link View Source to specific file on GitHub. otherwise, just link to repo homepage. */}}
{{- with .Site.Params.githubRepo }}
{{- with .Site.Params.social.githubRepo }}
{{- $githubURL := printf "https://github.com/%s" . }}
{{- if not $.IsPage }}
{{- $.Scratch.Set "sourceURL" $githubURL }}

View File

@ -21,20 +21,20 @@
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
<meta property="article:modified_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
{{- end }}
{{- with .Site.Author.facebook }}
{{- with .Site.Author.social.facebook }}
<meta property="article:author" content="https://www.facebook.com/{{ . }}">{{ end }}
{{- with .Params.tags }}{{ range . }}
<meta property="article:tag" content="{{ . }}">{{ end }}{{ end }}
{{ end -}}
{{ with .Site.Author.facebookid }}<meta property="fb:admins" content="{{ . }}">{{ end }}
{{ with .Site.Params.facebookAppID }}<meta property="fb:app_id" content="{{ . }}">{{ end }}
{{ with .Site.Author.social.facebookid }}<meta property="fb:admins" content="{{ . }}">{{ end }}
{{ with .Site.Params.social.facebookAppID }}<meta property="fb:app_id" content="{{ . }}">{{ end }}
<meta name="twitter:card" content="{{ if .IsPage }}summary_large_image{{ else }}summary{{ end }}">
<meta name="twitter:domain" content="{{ (urls.Parse .Site.BaseURL).Host }}">
{{- with .Site.Author.twitter }}
{{- with .Site.Author.social.twitter }}
<meta name="twitter:site" content="{{ printf "%s%s" "@" . }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}">
{{ end -}}
{{ with .Site.Author.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }}
{{ with .Site.Author.social.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }}
<meta name="twitter:dnt" content="on">

View File

@ -6,8 +6,7 @@
"@id": {{ path.Join $.Site.BaseURL "#author" }},
"name": {{ .name }},
"url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}{{ with $.Scratch.Get "authorImage" }}
"description": {{ $.Site.Params.description }},{{ with $.Scratch.Get "authorImage" }}
"image": {
"@type": "ImageObject",
"url": {{ .Permalink }},
@ -15,7 +14,7 @@
"height": "{{ .Height }}"
},{{ end }}
"sameAs": [
{{ $.Site.BaseURL }},
{{ $.Site.BaseURL }},{{ with .social }}
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}
{{ with .keybase }}{{ printf "%s%s" "https://keybase.io/" . }},{{ end }}
{{ with .twitter }}{{ printf "%s%s" "https://twitter.com/" . }},{{ end }}
@ -23,7 +22,7 @@
{{ with .linkedin }}{{ printf "%s%s%s" "https://www.linkedin.com/in/" . "/" }},{{ end }}
{{ with .facebook }}{{ printf "%s%s" "https://www.facebook.com/" . }},{{ end }}
{{ with .instagram }}{{ printf "%s%s%s" "https://www.instagram.com/" . "/" }},{{ end }}
{{ with .mastodon }}{{ printf "%s%s" "https://" . }}{{ end }}
{{ with .mastodon }}{{ printf "%s%s" "https://" . }}{{ end }}{{ end }}
]
}
</script>

View File

@ -1,11 +1,11 @@
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "css/main.css" "includePaths" (slice "node_modules/")) | resources.PostCSS (dict "config" "postcss.config.js") }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{/* Page-specific styles set via front matter, scoped via SCSS and inlined */}}
{{/* Page-specific styles set via front matter, piped through PostCSS and inlined */}}
{{- with .Params.css -}}
{{/* NOTE: This file doesn't end up getting published (which is good) */}}
{{- $target := path.Join $.File.Dir "css/inline.scss" -}}
{{- $css := . | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
{{- $target := path.Join $.File.Dir "css/inline.css" -}}
{{- $css := . | resources.FromString $target | resources.PostCSS (dict "config" "postcss.config.js") -}}
{{/* Already being minified to my taste by PostCSS above */}}
{{ printf "<!-- htmlmin:ignore -->" | safeHTML -}}

View File

@ -1,4 +1,4 @@
{{ with .Site.Params.webmentionIO }}
{{ with .Site.Params.social.webmentionIO }}
<link rel="pingback" href="https://webmention.io/{{ . }}/xmlrpc">
<link rel="webmention" href="https://webmention.io/{{ . }}/webmention">
{{ end }}

View File

@ -1,10 +1,10 @@
<footer>
<div class="row">
<div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license }}</a>, {{ with .Site.Params.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div>
<div id="y2k"><a class="no-underline" href="https://y2k.land/" title="Made for Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ "img/ie.gif" | absURL }}" style="width: 88px; height: 31px;" alt="Made for Internet Explorer&reg;"></a></div>
<div id="poweredby">
Made with <span class="beat">❤️</span> and <a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Hugo</a>.
{{ with .Scratch.Get "sourceURL" }}<a class="no-underline" href="{{ . | safeURL }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }}
</div>
<div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.license.nameLong }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license.name }}</a>, {{ with .Site.Params.license.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div>
{{ $ieGif := resources.Get "img/ie.gif" -}}
<div id="y2k"><a class="no-underline" href="https://y2k.land/" title="This site works best with Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ $ieGif.Permalink }}" style="width: {{ $ieGif.Width }}px; height: {{ $ieGif.Height }}px;" alt="This site works best with Internet Explorer&reg;"></a></div>
<div id="poweredby">Made with <span class="beat">❤️</span> and <a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Hugo</a>. {{ with .Scratch.Get "sourceURL" }}<a class="no-underline" href="{{ . | safeURL }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }}</div>
</div>
</footer>

View File

@ -1,6 +1,6 @@
<amp-video
layout="responsive"
width="{{ with .Get "width" }}{{ . }}{{ else }}{{ .Site.Params.maxWidth }}{{ end }}"
width="{{ with .Get "width" }}{{ . }}{{ else }}{{ .Site.Params.Theme.maxWidth }}{{ end }}"
height="{{ with .Get "height" }}{{ . }}{{ else }}600{{ end }}"
{{- with .Page.Resources.GetMatch (.Get "poster") }} poster="{{ .Permalink }}"{{ end }}
{{- if .Get "autoplay" }} autoplay{{ end }}