Initial commit for Hugo site.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<style>
|
||||
body {
|
||||
--sidebar-bg-color: {{ with .Site.Params.sidebar_bg_color }}{{ . }}{{ else }}#202020{{ end }};
|
||||
--sidebar-img-border-color: {{ with .Site.Params.sidebar_img_border_color }}{{ . }}{{ else }}#515151{{ end }};
|
||||
--sidebar-p-color: {{ with .Site.Params.sidebar_p_color }}{{ . }}{{ else }}#909090{{ end }};
|
||||
--sidebar-h1-color: {{ with .Site.Params.sidebar_h1_color }}{{ . }}{{ else }}#FFF{{ end }};
|
||||
--sidebar-a-color: {{ with .Site.Params.sidebar_a_color }}{{ . }}{{ else }}#FFF{{ end }};
|
||||
--sidebar-socials-color: {{ with .Site.Params.sidebar_socials_color }}{{ . }}{{ else }}#FFF{{ end }};
|
||||
--text-color: {{ with .Site.Params.text_color }}{{ . }}{{ else }}#222{{ end }};
|
||||
--bkg-color: {{ with .Site.Params.content_bg_color }}{{ . }}{{ else }}#FAF9F6{{ end }};
|
||||
--post-title-color: {{ with .Site.Params.post_title_color }}{{ . }}{{ else }}#303030{{ end }};
|
||||
--list-color: {{ with .Site.Params.list_color }}{{ . }}{{ else }}#5a5a5a{{ end }};
|
||||
--link-color: {{ with .Site.Params.link_color }}{{ . }}{{ else }}#268bd2{{ end }};
|
||||
--date-color: {{ with .Site.Params.date_color }}{{ . }}{{ else }}#515151{{ end }};
|
||||
--table-border-color: {{ with .Site.Params.table_border_color }}{{ . }}{{ else }}#E5E5E5{{ end }};
|
||||
--table-stripe-color: {{ with .Site.Params.table_stripe_color }}{{ . }}{{ else }}#F9F9F9{{ end }};
|
||||
--code-color: {{ with .Site.Params.code_color }}{{ . }}{{ else }}#000{{ end }};
|
||||
--code-background-color: {{ with .Site.Params.code_background_color }}{{ . }}{{ else }}#E5E5E5{{ end }};
|
||||
--code-block-color: {{ with .Site.Params.code_block_color }}{{ . }}{{ else }}#fff{{ end }};
|
||||
--code-block-background-color: {{ with .Site.Params.code_block_background_color }}{{ . }}{{ else }}#272822{{ end }};
|
||||
--moon-sun-color: {{ with .Site.Params.moon_sun_color }}{{ . }}{{ else }}#FFF{{ end }};
|
||||
--moon-sun-background-color: {{ with .Site.Params.moon_sun_background_color }}{{ . }}{{ else }}#515151{{ end }};
|
||||
}
|
||||
body.dark-theme {
|
||||
--text-color: {{ with .Site.Params.text_color_dark }}{{ . }}{{ else }}#eee{{ end }};
|
||||
--bkg-color: {{ with .Site.Params.content_bg_color_dark }}{{ . }}{{ else }}#121212{{ end }};
|
||||
--post-title-color: {{ with .Site.Params.post_title_color_dark }}{{ . }}{{ else }}#DBE2E9{{ end }};
|
||||
--list-color: {{ with .Site.Params.list_color_dark }}{{ . }}{{ else }}#9d9d9d{{ end }};
|
||||
--link-color: {{ with .Site.Params.link_color_dark }}{{ . }}{{ else }}#268bd2{{ end }};
|
||||
--date-color: {{ with .Site.Params.date_color_dark }}{{ . }}{{ else }}#9a9a9a{{ end }};
|
||||
--table-border-color: {{ with .Site.Params.table_border_color_dark }}{{ . }}{{ else }}#515151{{ end }};
|
||||
--table-stripe-color: {{ with .Site.Params.table_stripe_color_dark }}{{ . }}{{ else }}#202020{{ end }};
|
||||
--code-color: {{ with .Site.Params.code_color_dark }}{{ . }}{{ else }}#fff{{ end }};
|
||||
--code-background-color: {{ with .Site.Params.code_background_color_dark }}{{ . }}{{ else }}#515151{{ end }};
|
||||
--code-block-color: {{ with .Site.Params.code_block_color_dark }}{{ . }}{{ else }}#fff{{ end }};
|
||||
--code-block-background-color: {{ with .Site.Params.code_block_background_color_dark }}{{ . }}{{ else }}#272822{{ end }};
|
||||
}
|
||||
body {
|
||||
background-color: var(--bkg-color);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"{{with .Site.LanguageCode}} xml:lang="{{.}}" lang="{{.}}"{{end}}>
|
||||
<head>
|
||||
{{ partial "head/scripts.html" . }}
|
||||
|
||||
<!-- Content Type -->
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<!-- Enable responsiveness on mobile devices-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="icon" href={{ .Site.Params.favicon | default "/favicon.png" }}>
|
||||
|
||||
<!-- META -->
|
||||
{{ partial "head/meta.html" . }}
|
||||
|
||||
<!-- CSS stylesheets -->
|
||||
{{ partial "head/stylesheets.html" . }}
|
||||
|
||||
<!-- Custom style tag for parameterized CSS -->
|
||||
{{ partial "head/css.html" . }}
|
||||
</head>
|
||||
@@ -0,0 +1,127 @@
|
||||
{{ .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 "2006-01-02T15:04:05Z07:00" }}" />
|
||||
|
||||
<!-- 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 and (eq .Section "posts") (.Page.IsNode) }}
|
||||
<!-- Pagination meta tags for list pages only -->
|
||||
{{ $paginator := .Paginate (where .Pages "Type" "posts") }}
|
||||
{{ if $paginator }}
|
||||
<link rel="first" href="{{ $paginator.First.URL }}" />
|
||||
<link rel="last" href="{{ $paginator.Last.URL }}" />
|
||||
{{ if $paginator.HasPrev }}
|
||||
<link rel="prev" href="{{ $paginator.Prev.URL }}" />
|
||||
{{end }}
|
||||
{{ if $paginator.HasNext }}
|
||||
<link rel="next" href="{{ $paginator.Next.URL }}" />
|
||||
{{end }}
|
||||
{{end }}
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:publisher" content="{{ .Site.Params.facebook_url }}" />
|
||||
<meta property="og:article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
|
||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
|
||||
|
||||
{{ with (or (.Params.Author) (.Site.Language.Params.Author.Name)) }}
|
||||
<meta property="og:article:author" content="{{ . }}" />
|
||||
<meta property="article:author" content="{{ . }}" />
|
||||
<meta name="author" content="{{ . }}" />
|
||||
{{ 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,0 +1,33 @@
|
||||
{{/* Personal/custom script for light/dark mode and tabs */}}
|
||||
{{ $js := slice
|
||||
(resources.Get "js/light_dark.js")
|
||||
(resources.Get "js/tabs.js") }}
|
||||
|
||||
{{/* Locally hosted code for KaTeX */}}
|
||||
{{ $js = $js | append
|
||||
(resources.Get "js/lib/katex.js")
|
||||
(resources.Get "js/lib/auto-render.js") }}
|
||||
|
||||
{{/* Personal/custom scripts for KaTeX */}}
|
||||
{{ $js = $js | append (resources.Get "js/katex.js") }}
|
||||
|
||||
{{/* Personal/custom scripts for table of contents */}}
|
||||
{{ if not .Site.Params.hideToc }}
|
||||
{{ $js = $js | append (resources.Get "js/toc.js") }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Personal/custom scripts for codeblocks */}}
|
||||
{{ $js = $js | append (resources.Get "js/codeblock.js") }}
|
||||
|
||||
{{ $js_bundle := $js | resources.Concat "js/bundle.js" | minify | fingerprint }}
|
||||
|
||||
<script defer language="javascript" type="text/javascript" src="{{ $js_bundle.RelPermalink }}"></script>
|
||||
|
||||
|
||||
{{ if .Site.Params.plausible }}
|
||||
<script defer data-domain="{{ .Site.Params.plausible_domain }}" src="{{ .Site.Params.plausible_script }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if hugo.IsProduction -}}
|
||||
{{ template "_internal/google_analytics.html" . -}}
|
||||
{{ end -}}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{ $css_bundle := slice
|
||||
(resources.Get "css/poole.css")
|
||||
(resources.Get "css/codeblock.css")
|
||||
(resources.Get "css/hyde.css")
|
||||
(resources.Get "css/poison.css")
|
||||
(resources.Get "css/fonts.css")
|
||||
(resources.Get "css/lib/katex.css")
|
||||
(resources.Get "css/tabs.css")
|
||||
(resources.Get "css/custom.css")
|
||||
| resources.Concat "css/bundle.css" | minify | fingerprint }}
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="{{ $css_bundle.RelPermalink }}">
|
||||
Reference in New Issue
Block a user