From 15db8bfd342ee9c648ab6201106c8ef63571b4cc Mon Sep 17 00:00:00 2001 From: Tommy Skaug Date: Tue, 1 Oct 2024 07:16:47 +0200 Subject: [PATCH] initial transfer from minindie --- LICENSE.md | 22 +++ README.md | 100 ++++++++++ archetypes/default.md | 4 + archetypes/posts.md | 11 ++ layouts/_default/_markup/render-image.html | 11 ++ layouts/_default/baseof.html | 26 +++ layouts/_default/list.html | 57 ++++++ layouts/_default/single.html | 74 ++++++++ layouts/_default/summary.html | 13 ++ layouts/_default/taxonomy.html | 45 +++++ layouts/bookmarks/single.html | 44 +++++ layouts/index.html | 8 + layouts/partials/article-extra.html | 0 layouts/partials/article-old-content.html | 6 + layouts/partials/article-precontent.html | 0 layouts/partials/article-prevnext.html | 17 ++ layouts/partials/article-related.html | 10 + layouts/partials/bio-hcard.html | 8 + layouts/partials/footer-extra.html | 0 layouts/partials/footer.html | 14 ++ layouts/partials/head-extra.html | 20 ++ layouts/partials/header.html | 17 ++ layouts/partials/homepage-body.html | 5 + layouts/partials/pagination.html | 9 + layouts/partials/single-title-extra.html | 3 + static/css/style.css | 204 +++++++++++++++++++++ theme.toml | 17 ++ 27 files changed, 745 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 archetypes/default.md create mode 100644 archetypes/posts.md create mode 100644 layouts/_default/_markup/render-image.html create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html create mode 100644 layouts/_default/summary.html create mode 100644 layouts/_default/taxonomy.html create mode 100644 layouts/bookmarks/single.html create mode 100644 layouts/index.html create mode 100644 layouts/partials/article-extra.html create mode 100644 layouts/partials/article-old-content.html create mode 100644 layouts/partials/article-precontent.html create mode 100644 layouts/partials/article-prevnext.html create mode 100644 layouts/partials/article-related.html create mode 100644 layouts/partials/bio-hcard.html create mode 100644 layouts/partials/footer-extra.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/head-extra.html create mode 100644 layouts/partials/header.html create mode 100644 layouts/partials/homepage-body.html create mode 100644 layouts/partials/pagination.html create mode 100644 layouts/partials/single-title-extra.html create mode 100644 static/css/style.css create mode 100644 theme.toml diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..630c225 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 Vimux + +Copyright (c) 2020 colorchestra + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..cef0972 --- /dev/null +++ b/README.md @@ -0,0 +1,100 @@ +# MinIndie + +This theme is **heavily** based on [smol](https://themes.gohugo.io/themes/smol/), a minimalist hugo theme, thanks to their work! + +MinIndie is a very minimal hugo theme with indieweb markups. A demo can be found on my blog at https://bacardi55.io + +## Features + +- No JavaScript +- No Google spyware or tracking of any kind +- No other external dependencies, embedded fonts or comment sections +- Dark mode support (depending on your OS's setting) +- Indieweb markup + +## Installation + +In your Hugo site `themes` directory, run: + +``` +git clone https:// +``` + +Next, open `config.toml` in the base of the Hugo site and ensure the theme option is set to `smol`. + +``` +theme = "minindie" +``` + +Lastly, add the following lines to your `config.toml` to set site parameters and make use of all the menu entries in the header and footer sections if you need them. + +``` +title = "Site Name" +baseURL = "https://your.domain.tld" +copyright = "A copyright message" + +# Parameters +[params] + subtitle = "ἕν οἶδα ὅτι οὐδὲν οἶδα" + dateFmt = "Monday, January 2, 2006" + # tagPostOlderThanXDays = 555 # To display a message if the post is older than this number of days. + # xslpath = "/rss.xsl" # If you want to theme your RSS feed. Optional. + +[params.author] + name = "your name" # required for h-card + email = "your@email.tld" + avatar = "/path/to/avatar.png" + bio = "A bio description
Html is accepted." + +[params.indieweb] + authorizationEndpoint = "https://indieauth.com/auth" + tokenEndpoint = "https://tokens.indieauth.com/token" + webmentionEndpoint = "https://webmention.io/your.domain.tld/webmention" + relmepgp = "/path/to//public/key.asc" + [[params.indieweb.relme]] + url = "https://" + [[params.indieweb.relme]] + url = "https://" + +# Menus: +## Header +[menu] + [[menu.main]] + identifier = "posts" + name = "Posts" + url = "/posts/" + weight = 1 + + [[menu.main]] + identifier = "categories" + name = "Categories" + url = "/categories/" + weight = 2 + + [[menu.main]] + identifier = "tags" + name = "Tags" + url = "/tags/" + weight = 3 + +## Footer + [[menu.footer]] + name = "Github" + url = "https://github.com/example" + weight = 1 + + [[menu.footer]] + name = "Mastodon" + url = "https://example.com/@user" + weight = 2 + + [[menu.footer]] + name = "Imprint" + url = "/imprint" + weight = 3 + +``` + +## License + +This theme is released under the [MIT license](https://github.com/colorchestra/smol/blob/master/LICENSE). diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..ef75f76 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,4 @@ ++++ +title = "{{ replace .Name "-" " " | title }}" +date = {{ .Date }} ++++ diff --git a/archetypes/posts.md b/archetypes/posts.md new file mode 100644 index 0000000..11182ff --- /dev/null +++ b/archetypes/posts.md @@ -0,0 +1,11 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +slug: {{ now.Format "2006-01-02" }}-{{ .Name | urlize }} +type: posts +draft: true +categories: + - default +tags: + - default +--- diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..41008ca --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,11 @@ +{{ if .Title }} +
+ {{ .Text }} +
{{ .Title }}
+
+{{ else }} +
+ {{ .Text }} +
+{{ end }} + diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..e8b6411 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,26 @@ + + + + + + + + {{ .Title }} | {{ .Site.Title }} + {{ with .Site.Params.description }}{{ end }} + {{ with .Site.Params.author }}{{ end }} + + {{ range .Site.Params.customCSS -}} + + {{- end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} + {{- end }} + + {{ partial "head-extra.html" . }} + + + {{ partial "header" . }} + {{ block "main" . }}{{ end }} + {{ partial "footer" . }} + + diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..f3639a1 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,57 @@ +{{ define "main" }} +
+ {{ $pageKind := .Kind }} + {{ if or .Title .Content }} +
+ {{ if .Title }} +

+ {{ .Title }} + {{ partial "single-title-extra.html" . }} +

+ {{ end }} + {{ with .Content }}
{{ . }}
{{ end }} +
+ {{ end }} + +
+ {{ $yearCptr := "" }} + {{ $monthCptr := "" }} + {{ range .Paginator.Pages }} + {{ $postYear := .Date.Year }} + {{ $postMonth := .Date.Month }} + + {{ if or (ne $monthCptr $postMonth) (and (eq $yearCptr "") (eq $monthCptr "")) }} + {{ $yearCptr = $postYear }} + {{ $monthCptr = $postMonth }} + {{ if and (ne $yearCptr "") (ne $monthCptr "") }} + +
+ {{ end }} +
+

{{ $monthCptr }} {{ $yearCptr }}

+
    + {{ end }} + +
  • + +
    + : + {{ if eq $pageKind "term" }}[{{ .Type }}] {{ end }} + + {{.Title }} + +
    +
  • + + {{ $yearCptr = $postYear }} + {{ $monthCptr = $postMonth }} + {{ end }} +
+
+ + + {{ partial "pagination.html" . }} +
+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..425efc1 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,74 @@ +{{ define "main" }} +{{ $ageDays := div (sub now.Unix .Date.Unix) 86400 }} +
+
+

{{ .Title }}

+ + + + {{ if .Date }} +
+ + - Permalink +
+ {{ end }} + + {{- if or .Params.categories .Params.tags -}} + + {{- end -}} + + {{- with .Site.Params.tagPostOlderThanXDays -}} + {{- if and (gt $ageDays .) (eq $.Type "posts") -}} + {{ partial "article-old-content.html" . }} + {{- end -}} + {{- end -}} + + {{- partial "article-precontent.html" . -}} + + {{- if .Params.toc -}} +
+

Table of Content

+ +
+ {{- end -}} + +
+ {{ .Content }} +
+ + {{ partial "article-extra.html" . }} + + {{ if .Site.Params.enableNextPrevPages }} + {{ partial "article-prevnext.html" . }} + {{ end }} + + {{ if .Site.Params.enableRelatedPages }} + {{ partial "article-related.html" . }} + {{ end }} +
+
+{{ end }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..a347932 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,13 @@ +
+

{{ .Title }}

+ + {{ range .Params.tags }} + {{ . }} + {{ end }} +
+ {{ .Summary }} + {{ if .Truncated }} + Read more... + {{ end }} +
+
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html new file mode 100644 index 0000000..9f63aae --- /dev/null +++ b/layouts/_default/taxonomy.html @@ -0,0 +1,45 @@ +{{ define "main" }} +{{ $pageTitle := .Title }} +
+
+

+ {{ .Title }} + + RSS icon + +

+
+ {{ .Content }} +
+ {{- if eq .Kind "taxonomy" -}} + + {{ end }} + {{- if eq .Kind "term" -}} +

Content linked to the taxonomy term « {{ strings.ToUpper .Title }} »:

+ {{ $currentType := "" }} + {{ range sort .Pages.ByDate.Reverse ".Type" "desc" }} + {{ if or (eq $currentType "") (ne $currentType .Type) }} + {{ if ne $currentType "" }} + +
+ {{ end }} +
+

{{ strings.FirstUpper .Type }}

+
    + {{ end }} +
  • + + {{ .Title }} +
  • + {{ $currentType = .Type }} + {{ end }} +
+
+ {{- end -}} + +
+{{ end }} diff --git a/layouts/bookmarks/single.html b/layouts/bookmarks/single.html new file mode 100644 index 0000000..8ee4bf1 --- /dev/null +++ b/layouts/bookmarks/single.html @@ -0,0 +1,44 @@ +{{ define "main" }} +
+
+ + +

+ + {{ .Title }} + +

+
+ + - Permalink +
+
+ Tags: + {{ range .Params.tags }} + {{ . }} + {{ end }} +
+ + {{ with .Params.description }} +
+ Description: +
{{ . }}
+
+ {{ end }} + + {{ with .Content }} +
{{ . }}
+ {{ end }} + +
+ → + {{ .Params.bookmark_url }} +

+
+ + {{ partial "article-extra.html" . }} +
+
+{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..777a2fd --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,8 @@ +{{ define "main" }} +
+
+

{{ .Site.Title }}

+ {{- partial "bio-hcard.html" . -}} + {{- partial "homepage-body.html" . -}} +
+{{ end }} diff --git a/layouts/partials/article-extra.html b/layouts/partials/article-extra.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/article-old-content.html b/layouts/partials/article-old-content.html new file mode 100644 index 0000000..785f3be --- /dev/null +++ b/layouts/partials/article-old-content.html @@ -0,0 +1,6 @@ +
+ /!\ Warning: This article is older than {{ . }} days, make sure the content + is still relevant! +
diff --git a/layouts/partials/article-precontent.html b/layouts/partials/article-precontent.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/article-prevnext.html b/layouts/partials/article-prevnext.html new file mode 100644 index 0000000..d89b779 --- /dev/null +++ b/layouts/partials/article-prevnext.html @@ -0,0 +1,17 @@ +
+ + + +
diff --git a/layouts/partials/article-related.html b/layouts/partials/article-related.html new file mode 100644 index 0000000..5a6fe50 --- /dev/null +++ b/layouts/partials/article-related.html @@ -0,0 +1,10 @@ +{{ $related := .Site.RegularPages.Related . | first 5 }} {{ with $related }} +
+

Releated Posts

+ +
+{{ end }} diff --git a/layouts/partials/bio-hcard.html b/layouts/partials/bio-hcard.html new file mode 100644 index 0000000..0a476e4 --- /dev/null +++ b/layouts/partials/bio-hcard.html @@ -0,0 +1,8 @@ +
+
+ {{ .Site.Params.Author.name }}'s avatar +

{{ .Site.Params.Author.Bio | safeHTML }}

+
+

{{ .Site.Params.Author.name }}

+
+
diff --git a/layouts/partials/footer-extra.html b/layouts/partials/footer-extra.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..978a390 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,14 @@ +
+ diff --git a/layouts/partials/head-extra.html b/layouts/partials/head-extra.html new file mode 100644 index 0000000..8c3984f --- /dev/null +++ b/layouts/partials/head-extra.html @@ -0,0 +1,20 @@ +{{- range .Site.Params.indieweb.relme }} + +{{- end -}} + +{{- with .Site.Params.indieweb.relmepgp -}} + +{{- end -}} + +{{ with .Site.Params.indieweb }} + + + +{{ end }} + diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..efbd8e1 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,17 @@ +
+
+
+ {{ strings.Repeat ( .Site.Params.Author.Name | len | add 6 ) "=" }}
+ == {{ .Site.Params.Author.Name }} ==
+ {{ strings.Repeat ( .Site.Params.Author.Name | len | add 6 ) "=" }} +
+
{{ .Site.Params.subtitle }}
+
+ +
diff --git a/layouts/partials/homepage-body.html b/layouts/partials/homepage-body.html new file mode 100644 index 0000000..151ef62 --- /dev/null +++ b/layouts/partials/homepage-body.html @@ -0,0 +1,5 @@ +{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }} +{{ range $paginator.Pages }} + {{ .Render "summary" }} +{{ end }} +{{ partial "pagination.html" . }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..79f8053 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,9 @@ +
+{{ if .Paginator.HasPrev }} + Previous Page +{{ end }} +{{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }} +{{ if .Paginator.HasNext }} + Next Page +{{ end }} +
diff --git a/layouts/partials/single-title-extra.html b/layouts/partials/single-title-extra.html new file mode 100644 index 0000000..e1fd211 --- /dev/null +++ b/layouts/partials/single-title-extra.html @@ -0,0 +1,3 @@ +{{ with .AlternativeOutputFormats.Get "rss" }} +RSS icon +{{ end }} diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..490840b --- /dev/null +++ b/static/css/style.css @@ -0,0 +1,204 @@ +html { + overflow-y: scroll; +} +:root { + --bgcolor: #f8f8f2; + --fontcolor: #282a36; + --linkcolor: #00e; + --visitedcolor: #00e; + --precolor: #fff; + --prebgcolor: #000; + --alertbgcolor: white; + --hrcolor: #00e; + --blockquotecolor: white; + --pcodecolor: #000; + --sitetitlecolor: #00e; +} +@media (prefers-color-scheme: dark) { + :root { + --bgcolor: #282a36; + --fontcolor: #f8f8f2; + --linkcolor: #ff79c6; + --visitedcolor: #ff79c6; + --precolor: #f8f8f2; + --prebgcolor: #383838; + --alertbgcolor: #44475a; + --hrcolor: #f8f8f2; + --blockquotecolor: #44475a; + --pcodecolor: #6272a4; + --sitetitlecolor: #f1fa8c; + } +} +body { + max-width: 800px; + margin: 40px auto; + padding: 0 10px; + font: 14px/1.5 monospace; + color: var(--fontcolor); + background: var(--bgcolor); +} +a:link { + color: var(--linkcolor); + text-decoration: none; +} +a:visited { + color: var(--visitedcolor); +} +a:active { + color: var(--visitedcolor); +} +a:hover { + text-decoration: underline; +} +h1, +h2, +h3 { + line-height: 1.2; + color: #bd93f9; +} +h2 { + padding-top: 15px; +} +h3 { + padding-top: 10px; +} +p { + margin-top: 1.5rem; +} +p > code, +li > code { + color: var(--precolor); + background: var(--pcodecolor); + padding: 2px; +} +code { + color: var(--precolor); + background: var(--prebgcolor); + padding: 2px; +} +pre { + color: var(--precolor); + background: var(--prebgcolor); + padding: 24px; + overflow-x: auto; +} +article { + padding: 24px 0; +} +.center { + display: block; + margin-left: auto; + margin-right: auto; + width: 100%; +} +figcaption { + color: #888; + font: 12px/1.5 monospace; + text-align: center; +} +figure { + margin: auto; +} +img { + display: block; + max-width: 100%; + height: auto; + margin: auto; +} +.avatar { + width: 100px; + height: 100px; + border-radius: 50%; +} +.alert { + color: var(--fontcolor); + background: var(--alertbgcolor); + padding: 24px; + overflow-x: auto; +} +.article-nextprev { + display: flex; + flex-flow: row wrap-reverse; + justify-content: space-between; +} +hr { + margin: 35px 33% 15px; + border-color: var(--hrcolor); + border-width: 3px; +} +hr.small { + margin: 35px 44% 25px; + border: 1px dashed var(--hrcolor); +} +blockquote { + background: var(--blockquotecolor); + margin: auto; + padding: 5px 25px; +} +ol, +ul { + padding-left: 1rem; +} +ul > li { + list-style-type: disclosure-closed; +} +.toc { + border: 1px solid var(--hrcolor); + margin: 0.5rem; + padding: 0rem 2rem; +} +h1.site-title { + color: var(--sitetitlecolor); + text-align: center; +} +.bio-card .bio { + display: flex; +} +.bio-card .bio > img { + margin-right: 2rem; + align-self: flex-start; +} +.bio-card .bio > p { + align-self: center; + text-align: left; +} +.bio-card .bio-name { + margin-top: 0; +} +@media all and (max-width: 800px) { + .bio-card .bio { + justify-content: space-around; + flex-direction: column; + } + .bio-card .bio > img { + align-self: center; + margin: auto; + } + .bio-card .bio > p { + align-self: center; + text-align: center; + } +} +@media print { + a, + a:visited { + color: #000; + text-decoration: none; + } + a::after{ + content: " (" attr(href) ") "; + } + blockquote, + code { + background: #fff; + margin: 0; + padding: 0 1.5em; + border: none; + } + nav, + footer, + hr, + .noprint { + display: none !important; + } +} diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..313427c --- /dev/null +++ b/theme.toml @@ -0,0 +1,17 @@ +name = "minindie" +license = "MIT" +licenselink = "https://git.sr.ht/~bacardi55/MinIndie/tree/main/item/LICENCE.md" +description = "Minimal Hugo theme for the indieweb." +homepage = "https://sr.ht/~bacardi55/MinIndie" +tags = ["blog", "minimal", "monospace", "dark mode", "simple", "clean", "light", "responsive", "fast", "no-js", "no-tracking", "privacy", "indieweb"] +features = ["blog", "privacy", "responsive", "fast", "indieweb"] +min_version = "0.0.1" + +[author] + name = "bacardi55" + homepage = "bacardi55.io" + +[original] + author = "Morph" + homepage = "https://morph.sh" + repo = "https://github.com/colorchestra/smol"