diff options
author | Gökmen Görgen <gkmngrgn@gmail.com> | 2022-02-21 04:16:06 +0300 |
---|---|---|
committer | Gökmen Görgen <gkmngrgn@gmail.com> | 2022-02-21 04:16:06 +0300 |
commit | 504a94b3b3e931bbb82512aada07e947e24467ae (patch) | |
tree | 2b97c19a7da9e45e8c6e58b6d5b05373ea6694f2 | |
parent | 46ffba0df3a48d92b6e263f7c91a577c32aeaab8 (diff) |
new structure for extensions.
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 18 | ||||
-rw-r--r-- | layouts/_default/terms.html | 33 | ||||
-rw-r--r-- | layouts/blog/section.html | 32 | ||||
-rw-r--r-- | layouts/blog/single.html | 127 | ||||
-rw-r--r-- | layouts/partials/footer.html | 14 | ||||
-rw-r--r-- | layouts/partials/footer_extra.html | 13 | ||||
-rw-r--r-- | layouts/partials/head.html | 35 | ||||
-rw-r--r-- | layouts/partials/head_extra.html | 21 | ||||
-rw-r--r-- | layouts/partials/script_bootstrap.html | 5 | ||||
-rw-r--r-- | layouts/partials/script_highlight.html | 11 | ||||
-rw-r--r-- | layouts/partials/script_latex.html | 9 | ||||
-rw-r--r-- | layouts/partials/script_progressively.html | 10 | ||||
-rw-r--r-- | layouts/partials/style_bootstrap.html | 6 | ||||
-rw-r--r-- | layouts/partials/style_highlight.html | 12 | ||||
-rw-r--r-- | layouts/partials/style_main.html | 13 | ||||
-rw-r--r-- | layouts/partials/style_progressively.html | 4 | ||||
-rw-r--r-- | static/css/highlight.css | 4 |
18 files changed, 129 insertions, 251 deletions
@@ -30,7 +30,7 @@ of the theme._ - Twitter - Homepage with latest and best posts. - Single pages, sections with a header and a list of articles -- Syntax highlighting with `hightlightjs` +- Syntax highlighting with `highlightjs` - Progressive images - Twitter cards support - LaTeX support with MathJax @@ -43,14 +43,14 @@ of the theme._ ## DEPENDENCY VERSIONS -- bootstrap: 5.0.1 -- highlightjs: 11.0.1 +- bootstrap: 5.1.3 +- highlightjs: 11.4.0 - mathjax: ^3.0.0 -- progressively: 1.2.5 +- progressively: latest stable version ## TYPOGRAPHY -You can customize the fonts copying and editing `head_extra.html` +You can customize the fonts copying and editing `style_main.html` file. The defaults are: - Title: Merriweather Sans @@ -73,6 +73,9 @@ file. The defaults are: - `icon_back.html` has been renamed `icon_prev.html`. - `header_extra.html` has been renamed `head_extra.html`. - HEAD tags have been moved to `head.html`. +- All script lines have been moved to `footer_extra.html`. +- `highlight.css` has been removed and a new partial template + `style_highlight.html` has been created. ### V2.0.0: NEW MARKDOWN PARSERS diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1fdcf05..f72e3a7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,19 @@ <!DOCTYPE html> <html lang="{{ .Site.LanguageCode }}"> - {{- partial "head.html" . -}} + {{- partial "head" . -}} + + <body> - {{- partial "header.html" . -}} - <div id="content">{{- block "main" . }}{{- end }}</div> - {{- partial "footer.html" . -}} + {{- partial "header" . -}} + + + <div id="content"> + {{- block "main" . }}{{- end }} + </div> + + {{- partial "footer" . -}} + {{- partial "footer_extra" . -}} + + {{- template "_internal/google_analytics_async.html" . -}} </body> </html> diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html deleted file mode 100644 index d1aaad6..0000000 --- a/layouts/_default/terms.html +++ /dev/null @@ -1,33 +0,0 @@ -{{ define "main" }} - {{ partial "header" . }} - - <div class="content"> - <div class="container"> - <div class="row justify-content-center"> - <div class="col-md-12 col-lg-10"> - <div class="markdown"> - <h1 class="mx-0 mx-md-4"> - {{ if eq .Title "Tags" }} - {{ i18n "title_tags" . }} - {{ else }} - {{ .Title }} - {{ end }} - </h1> - - <p class="h4"> - {{ $data := .Data }} - {{ range $key, $value := .Data.Terms.Alphabetical }} - <a href="{{ $value.Name | urlize }}" class="badge badge-light text-monospace"> - {{ $value.Name }} - <span class="badge badge-secondary">{{ $value.WeightedPages.Count }}</span> - </a> - {{ end }} - </p> - </div> - </div> - </div> - </div> - </div> - - {{ partial "footer" . }} -{{ end }} diff --git a/layouts/blog/section.html b/layouts/blog/section.html deleted file mode 100644 index e82ff9d..0000000 --- a/layouts/blog/section.html +++ /dev/null @@ -1,32 +0,0 @@ -{{ define "main" }} - {{ partial "header" . }} - - <div class="content"> - <div class="container"> - <div class="row justify-content-center"> - <div class="col-md-12 col-lg-10"> - <div class="markdown"> - {{ partial "content" . }} - </div> - - <div class="mx-0 mx-md-4 posts"> - <h1>{{ i18n "blog_posts" }}</h1> - - <ul class="mb-5 list-unstyled"> - {{ range (.Paginate (.Pages.GroupByDate "Jan, 2006" "desc")).PageGroups }} - <li class="groupby">{{ .Key }}</li> - {{ range sort .Pages "Date" "desc" }} - {{ partial "list" . }} - {{ end }} - {{ end }} - </ul> - - {{ template "_internal/pagination.html" . }} - </div> - </div> - </div> - </div> - </div> - - {{ partial "footer" . }} -{{ end }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html deleted file mode 100644 index c5cd500..0000000 --- a/layouts/blog/single.html +++ /dev/null @@ -1,127 +0,0 @@ -{{ define "main" }} - {{ $isTocEnabled := or (.Params.toc) (and (.Site.Params.toc) (or (not (isset .Params "toc")) (.Params.toc))) }} - - {{ .Scratch.Set "isTocEnabled" $isTocEnabled }} - - {{ partial "header" . }} - - <div class="content"> - <div class="container"> - <div class="row justify-content-center"> - <div - {{ if $isTocEnabled }} - class="col-md-9 col-lg-9" - {{ else }} - class="col-md-12 col-lg-10" - {{ end }} - > - <h1 class="mx-0 mx-md-4"> - {{ .Title }} - </h1> - - <div class="mb-4 mb-md-5 meta"> - <span class="date" title='{{ .Date.Format "Mon Jan 2 2006 15:04:05 MST" }}'> - {{ .Date.Format "January 02, 2006" }} - </span> - - {{ if not .Params.noauthor }} - {{ if .Params.author }} - <span class="author middot" title="{{ .Params.Author }}"> - {{ .Params.author }} - </span> - {{ end }} - {{ end }} - - <span class="reading-time middot"> - {{ i18n "reading_time" .ReadingTime }} - </span> - - <div class="d-none d-md-inline tags"> - <ul class="list-unstyled d-inline"> - {{ range .Params.tags }} - <li class="d-inline middot"> - <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> - </li> - {{ end }} - </ul> - </div> - - <div class="d-none d-md-inline tags"> - <ul class="list-unstyled d-inline"> - {{ if isset .Params "hacker_news_id" }} - {{ if ne .Params.hacker_news_id "" }} - <li class="d-inline middot"> - <a href="https://news.ycombinator.com/item?id={{ .Params.hacker_news_id }}">Hacker News</a> - </li> - {{ end }} - {{ end }} - {{ if isset .Params "lobsters_id" }} - {{ if ne .Params.lobsters_id "" }} - <li class="d-inline middot"> - <a href="https://lobste.rs/s/{{ .Params.lobsters_id }}">Lobsters</a> - </li> - {{ end }} - {{ end }} - </ul> - </div> - </div> - - <div class="markdown"> - {{ partial "content" . }} - </div> - </div> - - {{ if $isTocEnabled }} - <div class="col-sm-12 col-md-3"> - {{ replace .TableOfContents "id=\"TableOfContents\"" "id=\"TableOfContents\" class=\"sticky-top\"" | safeHTML }} - </div> - {{ end }} - </div> - - <div class="row{{ if not $isTocEnabled }} justify-content-center{{ end }}"> - <div - {{ if $isTocEnabled }} - class="col-md-9 col-lg-9" - {{ else }} - class="col-md-12 col-lg-10" - {{ end }} - > - {{ if .Site.Params.posts_navigation }} - <div class="navigation"> - <div class="row"> - <div class="col-12 col-md-6"> - {{ if .PrevInSection }} - <div class="mx-0 mx-md-4 mt-4 text-start"> - <a href="{{ .PrevInSection.Permalink }}"> - {{ partial "icon_back" . }} - <span class="text">{{ .PrevInSection.Title }}</span> - </a> - </div> - {{ end }} - </div> - <div class="col-12 col-md-6"> - {{ if .NextInSection }} - <div class="mx-0 mx-md-4 mt-4 text-end"> - <a href="{{ .NextInSection.Permalink }}"> - <span class="text">{{ .NextInSection.Title }}</span> - {{ partial "icon_next" . }} - </a> - </div> - {{ end }} - </div> - </div> - </div> - {{ end }} - - {{ if .Site.DisqusShortname }} - <div class="mt-5 mx-0 mx-md-4 disqus"> - {{ template "_internal/disqus.html" . }} - </div> - {{ end }} - </div> - </div> - </div> - </div> - - {{ partial "footer" . }} -{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 5d01f02..7af8ab7 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,7 +6,7 @@ {{ range .Site.Menus.footer.ByWeight }} <div> <a - class="mx-1 mr-md-2 ml-md-0 {{ if .Identifier }} + class="mx-1 mr-md-2 ml-md-0{{ if .Identifier }} text-{{ .Identifier }} {{ end }}" href="{{ .URL }}" @@ -19,13 +19,13 @@ {{ if .Site.Params.copyright }} {{ if .Site.Params.copyrightUrl }} - <a href="{{ .Site.Params.copyrightUrl }}" - >{{ .Site.Params.copyright }}</a - > + <a href="{{ .Site.Params.copyrightUrl }}"> + {{ .Site.Params.copyright }} + </a> {{ else }} - <a href="{{ .Site.BaseURL }}license" - >{{ .Site.Params.copyright }}</a - > + <a href="{{ .Site.BaseURL }}license"> + {{ .Site.Params.copyright }} + </a> {{ end }} {{ end }} </div> diff --git a/layouts/partials/footer_extra.html b/layouts/partials/footer_extra.html index e69de29..0215932 100644 --- a/layouts/partials/footer_extra.html +++ b/layouts/partials/footer_extra.html @@ -0,0 +1,13 @@ +{{- partial "script_bootstrap" . -}} + +{{ if .Site.Params.highlightjs }} + {{- partial "script_highlight" . -}} +{{ end }} + +{{ if .Site.Params.progressively }} + {{- partial "script_progressively" . -}} +{{ end }} + +{{ if .Site.Params.uselatex }} + {{- partial "script_latex" . -}} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5bbd183..1023921 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -58,44 +58,19 @@ <link rel="canonical" href="{{ .Permalink }}" /> - <link - href="//cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" - rel="stylesheet" - integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" - crossorigin="anonymous" - /> - - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css" /> - - {{ if .Site.Params.highlightjs }} - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/highlight.css" /> - {{ end }} - - {{ if .Site.Params.progressively }} - <link - rel="stylesheet" - href="//cdn.jsdelivr.net/npm/progressively@1.2.5/dist/progressively.min.css" - integrity="sha256-xbqLYBMsjpuCihs+3Fgp/MFMtPdo2SWKoOjEWOqR4X0=" - crossorigin="anonymous" - /> + {{ if .Site.Params.faviconfile }} + <link rel="shortcut icon" href="{{ .Site.Params.faviconfile | absURL }}" /> + {{ else }} + <link rel="shortcut icon" href="{{ .Site.BaseURL }}img/favicon.ico" /> {{ end }} <link - rel="shortcut icon" - href="{{ if .Site.Params.faviconfile }} - {{ .Site.Params.faviconfile | absURL }} - {{ else }} - {{ .Site.BaseURL }}img/favicon.ico - {{ end }}" - /> - - <link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> - {{ partial "head_extra" . }} + {{- partial "head_extra" . -}} </head> diff --git a/layouts/partials/head_extra.html b/layouts/partials/head_extra.html index 586a74c..fac508c 100644 --- a/layouts/partials/head_extra.html +++ b/layouts/partials/head_extra.html @@ -1,12 +1,11 @@ -<link - href="//fonts.googleapis.com/css?family=Fira+Code|Merriweather+Sans:400,700|Merriweather:400,700&display=swap" - rel="stylesheet" -/> +{{- partial "style_bootstrap" . -}} -<style> - :root { - --font-code: "Fira Code", monospace; - --font-content: "Merriweather", serif; - --font-title: "Merriweather Sans", sans-serif; - } -</style> +{{- partial "style_main" . -}} + +{{ if .Site.Params.highlightjs }} + {{- partial "style_highlight" . -}} +{{ end }} + +{{ if .Site.Params.progressively }} + {{- partial "style_progressively" . -}} +{{ end }} diff --git a/layouts/partials/script_bootstrap.html b/layouts/partials/script_bootstrap.html new file mode 100644 index 0000000..ff6b00a --- /dev/null +++ b/layouts/partials/script_bootstrap.html @@ -0,0 +1,5 @@ +<script + src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" + integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" + crossorigin="anonymous" +></script> diff --git a/layouts/partials/script_highlight.html b/layouts/partials/script_highlight.html new file mode 100644 index 0000000..cd2ccb1 --- /dev/null +++ b/layouts/partials/script_highlight.html @@ -0,0 +1,11 @@ +<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> + +{{ range .Site.Params.highlightjslanguages }} +<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/{{.}}.min.js" defer></script> +{{ end }} + +<script> +window.addEventListener('load', function() { + hljs.highlightAll(); +}, true); +</script> diff --git a/layouts/partials/script_latex.html b/layouts/partials/script_latex.html new file mode 100644 index 0000000..4259594 --- /dev/null +++ b/layouts/partials/script_latex.html @@ -0,0 +1,9 @@ +<script type="text/x-mathjax-config"> + MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } }); +</script> +<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> +<script + id="MathJax-script" + async + src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" +></script> diff --git a/layouts/partials/script_progressively.html b/layouts/partials/script_progressively.html new file mode 100644 index 0000000..fe27c39 --- /dev/null +++ b/layouts/partials/script_progressively.html @@ -0,0 +1,10 @@ +<script src="https://cdn.jsdelivr.net/npm/progressively/dist/progressively.min.js"></script> +<script> + window.addEventListener( + "load", + function () { + progressively.init({ delay: 30, throttle: 50 }); + }, + true + ); +</script> diff --git a/layouts/partials/style_bootstrap.html b/layouts/partials/style_bootstrap.html new file mode 100644 index 0000000..52009e2 --- /dev/null +++ b/layouts/partials/style_bootstrap.html @@ -0,0 +1,6 @@ +<link + href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" + rel="stylesheet" + integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" + crossorigin="anonymous" +/> diff --git a/layouts/partials/style_highlight.html b/layouts/partials/style_highlight.html new file mode 100644 index 0000000..702e2bb --- /dev/null +++ b/layouts/partials/style_highlight.html @@ -0,0 +1,12 @@ +<link + rel="stylesheet" + href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/github.min.css" +/> +<link + rel="stylesheet" + href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/tomorrow-night-bright.min.css" +/> + +<style> + screen and (prefers-color-scheme: dark); +</style> diff --git a/layouts/partials/style_main.html b/layouts/partials/style_main.html new file mode 100644 index 0000000..a8e9514 --- /dev/null +++ b/layouts/partials/style_main.html @@ -0,0 +1,13 @@ +<link + rel="stylesheet" + href="//fonts.googleapis.com/css?family=Fira+Code|Merriweather+Sans:400,700|Merriweather:400,700&display=swap" +/> +<link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css" /> + +<style> + :root { + --font-code: "Fira Code", monospace; + --font-content: "Merriweather", serif; + --font-title: "Merriweather Sans", sans-serif; + } +</style> diff --git a/layouts/partials/style_progressively.html b/layouts/partials/style_progressively.html new file mode 100644 index 0000000..9e3136a --- /dev/null +++ b/layouts/partials/style_progressively.html @@ -0,0 +1,4 @@ +<link + rel="stylesheet" + href="https://cdn.jsdelivr.net/npm/progressively/dist/progressively.min.css" +/> diff --git a/static/css/highlight.css b/static/css/highlight.css index 0013c22..f0b3a62 100644 --- a/static/css/highlight.css +++ b/static/css/highlight.css @@ -1,3 +1,3 @@ -@import "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.0.1/build/styles/github.min.css"; -@import "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.0.1/build/styles/tomorrow-night-bright.min.css" +@import "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/github.min.css"; +@import "https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/tomorrow-night-bright.min.css" screen and (prefers-color-scheme: dark); |