From 42f0673a5bbfdeb75d17000ef12a28e0a2c4b31a Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sun, 24 May 2020 09:30:26 +0200 Subject: [PATCH] Initial commit --- LICENSE.md | 24 ++++ README.md | 7 ++ assets/css/style.scss | 129 +++++++++++++++++++++ assets/js/speak.js | 45 +++++++ config.yaml | 8 ++ go.mod | 3 + i18n/de.yaml | 50 ++++++++ i18n/en.yaml | 53 +++++++++ layouts/404.html | 6 + layouts/_default/_markup/render-image.html | 1 + layouts/_default/_markup/render-link.html | 1 + layouts/_default/baseof.html | 30 +++++ layouts/_default/list.html | 14 +++ layouts/_default/list.jsonfeed.json | 39 +++++++ layouts/_default/photosummary.html | 6 + layouts/_default/rss.xml | 37 ++++++ layouts/_default/section.podcast.xml | 41 +++++++ layouts/_default/single.html | 27 +++++ layouts/_default/sitemap.xml | 22 ++++ layouts/_default/summary.html | 8 ++ layouts/index.html | 12 ++ layouts/partials/authorbox.html | 14 +++ layouts/partials/cleanedContent.json | 1 + layouts/partials/cleanedContent.xml | 1 + layouts/partials/custombodyend.html | 0 layouts/partials/customhead.html | 0 layouts/partials/footer.html | 13 +++ layouts/partials/header.html | 7 ++ layouts/partials/indiewebhead.html | 17 +++ layouts/partials/list_meta.html | 5 + layouts/partials/mentions.html | 30 +++++ layouts/partials/menu.html | 6 + layouts/partials/oldcontentwarning.html | 7 ++ layouts/partials/pagination.html | 11 ++ layouts/partials/post_actions.html | 16 +++ layouts/partials/post_meta.html | 20 ++++ layouts/partials/post_tags.html | 14 +++ layouts/partials/related.html | 11 ++ layouts/partials/styles.html | 6 + layouts/partials/summary_meta.html | 21 ++++ layouts/photos/list.html | 14 +++ layouts/robots.txt | 4 + layouts/tags/terms.html | 12 ++ theme.toml | 11 ++ 44 files changed, 804 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 assets/css/style.scss create mode 100644 assets/js/speak.js create mode 100644 config.yaml create mode 100644 go.mod create mode 100644 i18n/de.yaml create mode 100644 i18n/en.yaml create mode 100644 layouts/404.html create mode 100644 layouts/_default/_markup/render-image.html create mode 100644 layouts/_default/_markup/render-link.html create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/list.jsonfeed.json create mode 100644 layouts/_default/photosummary.html create mode 100644 layouts/_default/rss.xml create mode 100644 layouts/_default/section.podcast.xml create mode 100644 layouts/_default/single.html create mode 100644 layouts/_default/sitemap.xml create mode 100644 layouts/_default/summary.html create mode 100644 layouts/index.html create mode 100644 layouts/partials/authorbox.html create mode 100644 layouts/partials/cleanedContent.json create mode 100644 layouts/partials/cleanedContent.xml create mode 100644 layouts/partials/custombodyend.html create mode 100644 layouts/partials/customhead.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/header.html create mode 100644 layouts/partials/indiewebhead.html create mode 100644 layouts/partials/list_meta.html create mode 100644 layouts/partials/mentions.html create mode 100644 layouts/partials/menu.html create mode 100644 layouts/partials/oldcontentwarning.html create mode 100644 layouts/partials/pagination.html create mode 100644 layouts/partials/post_actions.html create mode 100644 layouts/partials/post_meta.html create mode 100644 layouts/partials/post_tags.html create mode 100644 layouts/partials/related.html create mode 100644 layouts/partials/styles.html create mode 100644 layouts/partials/summary_meta.html create mode 100644 layouts/photos/list.html create mode 100644 layouts/robots.txt create mode 100644 layouts/tags/terms.html create mode 100644 theme.toml diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..cf1ab25 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b0ed93 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Indiego + +This is the Hugo theme for [my blog](https://jlelse.blog/). + +A lot of things are customized to my own needs, but I wanted to open source the code, because it might be helpful to others to see how I implemented things. + +This theme is released to the public domain, so you can do whatever you want with it. But of course it would be nice, if you give attributions and contribute improvements. Thanks! \ No newline at end of file diff --git a/assets/css/style.scss b/assets/css/style.scss new file mode 100644 index 0000000..d2d3965 --- /dev/null +++ b/assets/css/style.scss @@ -0,0 +1,129 @@ +$colors: ( + background: #fff, + background-dark: #000, + primary: #000, + primary-dark: #fff +); + +@mixin color($property, $varName) { + #{$property}: map-get($colors, $varName); + #{$property}: var(--#{$varName}, map-get($colors, $varName)); +} + +@mixin color-border($property, $val1, $val2, $varName) { + #{$property}: #{$val1} #{$val2} map-get($colors, $varName); + #{$property}: #{$val1} #{$val2} var(--#{$varName}, map-get($colors, $varName)); +} + +@mixin lightmode { + --background: #{map-get($colors, background)}; + --primary: #{map-get($colors, primary)}; + color: #000; +} + +@mixin darkmode { + --background: #{map-get($colors, background-dark)}; + --primary: #{map-get($colors, primary-dark)}; + color: #fff; +} + +html { + @include lightmode; + @media (prefers-color-scheme: dark) { + @include darkmode; + } +} + +body { + /* Background color */ + @include color(background, background); + /* Font settings */ + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + line-height: 1.5; + /* Center body */ + margin: 0 auto; + max-width: 750px; + padding: 10px; + /* Wrapping */ + word-break: break-word; + overflow-wrap: break-word; + * { + @include color(color, primary); + max-width: 100%; + } +} + +header { + padding: 10px 0; + * { + margin-top: 0; + margin-bottom: 0; + } + h1 a { + text-decoration: none; + } +} + +img { + width: 100%; +} + +input, button { + @include color-border(border, 1px, solid, primary); + @include color(background, background); + @include color(color, primary); + padding: 5px 10px; + border-radius: 0; + box-sizing: border-box; +} + +blockquote { + @include color-border(border-left, 5px, solid, primary); + padding-left: 20px; + margin-left: 0; +} + +pre { + padding: 10px; + @include color-border(border, 1px, solid, primary); + white-space: pre-wrap; +} + +footer { + padding: 10px 0; + * { + margin-top: 0; + margin-bottom: 0; + } +} + +footer, .border-top { + @include color-border(border-top, 1px, solid, primary); +} + +header, .border-bottom { + @include color-border(border-bottom, 1px, solid, primary); +} + +.fake-p { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.flex { + display: flex; +} + +.hide { + display: none; +} + +.full-width { + width: 100%; +} + +.invert { + @include color(color, background); + @include color(background, primary); +} \ No newline at end of file diff --git a/assets/js/speak.js b/assets/js/speak.js new file mode 100644 index 0000000..18f0911 --- /dev/null +++ b/assets/js/speak.js @@ -0,0 +1,45 @@ +"use strict"; + +function getVoice() { + if (window.speechSynthesis) { + return window.speechSynthesis.getVoices().filter(voice => voice.lang.startsWith(document.querySelector('html').lang))[0]; + } + return false; +} + +function initSpeak() { + if (window.speechSynthesis) { + let speakBtn = document.querySelector('#speakBtn'); + speakBtn.style.display = ''; + speakBtn.onclick = function() { speak() }; + speakBtn.textContent = speakText; + } +} + +function speak() { + console.log("Start speaking") + let speakBtn = document.querySelector('#speakBtn'); + speakBtn.onclick = function() { stopSpeak() }; + speakBtn.textContent = stopSpeakText; + let textContent = + ((document.querySelector('article .p-name')) ? document.querySelector('article .p-name').innerText + "\n\n" : "") + + document.querySelector('article .e-content').innerText; + let utterThis = new SpeechSynthesisUtterance(textContent); + utterThis.voice = getVoice(); + utterThis.onerror = stopSpeak; + utterThis.onend = stopSpeak; + window.speechSynthesis.speak(utterThis); +} + +function stopSpeak() { + console.log("Stop speaking") + window.speechSynthesis.cancel(); + let speakBtn = document.querySelector('#speakBtn'); + speakBtn.onclick = function() { speak() }; + speakBtn.textContent = speakText; +} + +window.onbeforeunload = function () { + stopSpeak(); +} +initSpeak(); \ No newline at end of file diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..d85fab6 --- /dev/null +++ b/config.yaml @@ -0,0 +1,8 @@ +outputFormats: + jsonfeed: + mediaType: "application/json" + baseName: "feed" + isPlainText: true + podcast: + mediaType: "application/rss+xml" + baseName: "podcast" \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..af3ce00 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.jlel.se/jlelse/Indiego + +go 1.14 diff --git a/i18n/de.yaml b/i18n/de.yaml new file mode 100644 index 0000000..670d476 --- /dev/null +++ b/i18n/de.yaml @@ -0,0 +1,50 @@ +- id: read_more + translation: Weiterlesen + +- id: meta_lastmod + translation: Zuletzt geändert + +- id: meta_reply_to + translation: Antwort auf + +- id: meta_like_of + translation: Like von + +- id: 404_title + translation: Seite nicht gefunden + +- id: 404_text + translation: "Die gesuchte Seite existiert nicht, wurde verschoben oder gelöscht." + +- id: wmform_label + translation: "Hast du eine Antwort hierzu veröffentlicht? Füg dir URL hier ein." + +- id: wmform_btn + translation: "Senden" + +- id: anon_comment + translation: "Du kannst auch einen anonymen Kommentar erstellen." + +- id: related + translation: "Ähnlich" + +- id: share + translation: "Teilen" + +- id: interactions + translation: "Interaktionen" + +- id: translations + translation: Übersetzungen + +- id: oldcontent + translation: Dieser Eintrag ist bereits über ein Jahr alt. Er ist möglicherweise nicht mehr aktuell. Meinungen können sich geändert haben. + +- id: speak + translation: Lies mir bitte vor. + +- id: stopspeak + translation: Hör auf zu sprechen! + +- id: subscribe + translation: Abonnieren \ No newline at end of file diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..b5fb85b --- /dev/null +++ b/i18n/en.yaml @@ -0,0 +1,53 @@ +- id: read_more + translation: Read more + +- id: meta_lastmod + translation: Last modified + +- id: meta_reply_to + translation: Reply to + +- id: meta_like_of + translation: Like of + +- id: 404_title + translation: Page not found + +- id: 404_text + translation: "The page you were looking for appears to have been moved, deleted or does not exist." + +- id: wmform_label + translation: "Have you published a response to this? Paste the URL here." + +- id: wmform_btn + translation: "Send" + +- id: anon_comment + translation: "You can also create an anonymous comment." + +- id: related + translation: "Related" + +- id: share + translation: "Share" + +- id: interactions + translation: "Interactions" + +- id: also_on + translation: "Also on" + +- id: translations + translation: Translations + +- id: oldcontent + translation: This entry is already over one year old. It may no longer be up to date. Opinions may have changed. + +- id: speak + translation: Read to me, please. + +- id: stopspeak + translation: Stop speaking! + +- id: subscribe + translation: Subscribe \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..3599b5c --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,6 @@ +{{ define "main" }} +
+

{{ T "404_title" }}

+

{{ T "404_text" }}

+
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..7ec43bb --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1 @@ +{{ .Text }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..e496089 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1 @@ +{{ .Text | markdownify }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..f320be7 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,30 @@ + + + + + +{{ block "title" . }}{{ if not .IsHome }}{{ with .Title }}{{ . }} - {{end}}{{ end }}{{ .Site.Title }}{{ end }} + +{{ template "_internal/opengraph.html" . }} +{{ template "_internal/schema.html" . }} +{{ template "_internal/twitter_cards.html" . }} +{{ partialCached "styles" . }} + +{{ range .AlternativeOutputFormats }} + +{{ end }} +{{ if .Param "original" }} + +{{ else }} + +{{ end }} +{{ partialCached "indiewebhead" . (.Param "indieweb.enabled") }} +{{ partialCached "customhead" . }} +{{ partialCached "header" . }} +{{ block "main" . }} +{{ with .Content }} +{{ . }} +{{ end }} +{{ end }} +{{ partialCached "footer" . }} +{{ partialCached "custombodyend" . }} \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..db3d223 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,14 @@ +{{ define "main" }} +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ if not .Params.nometa }}{{ partial "list_meta" . }}{{ end }} + {{ with .Content }}{{ . }}{{ end }} + {{ if ne (.Param "hideList") true }} + {{ range .Paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + {{ end }} + {{ if (.Param "authorbox") }}{{ partialCached "authorbox" . }}{{ end }} +
+{{ partial "pagination" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/_default/list.jsonfeed.json b/layouts/_default/list.jsonfeed.json new file mode 100644 index 0000000..0afc458 --- /dev/null +++ b/layouts/_default/list.jsonfeed.json @@ -0,0 +1,39 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if eq $.Kind "taxonomyTerm" -}} +{{- $pages = $pctx.Pages -}} +{{- else -}} +{{- $pages = $pctx.RegularPages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- $postSections := ($.Param "postSections" | default (slice "posts")) }} +{{- $pages := ( where $pages "Type" "in" $postSections ) }} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{ + "version": "https://jsonfeed.org/version/1", + "title": "{{ .Site.Title }}", + "description": "{{ .Site.Params.description }}", + "home_page_url": "{{ .Permalink}}", + "feed_url": "{{ .Permalink }}feed.json", + "author": { + "name": "{{ .Site.Author.name }}", + "url": "{{ .Site.Author.link }}" + }, + "items": [ + {{ range $index, $pages := $pages }} + {{ if ge $index 1 }}, {{end}}{ + "id": "{{ .Permalink }}", + "url": "{{ .Permalink }}", + "title": {{ .Title | jsonify }}, + "content_html": {{ partialCached "cleanedContent.json" . .Permalink }}, + "summary": {{ .Summary | jsonify }}, + "date_published": {{ dateFormat "2006-01-02T15:04:05-07:00" .Date | jsonify }}, + "date_modified": {{ dateFormat "2006-01-02T15:04:05-07:00" .Lastmod | jsonify }}, + "tags": {{ .Params.Tags | jsonify }} + } + {{ end }} + ] +} \ No newline at end of file diff --git a/layouts/_default/photosummary.html b/layouts/_default/photosummary.html new file mode 100644 index 0000000..bad0733 --- /dev/null +++ b/layouts/_default/photosummary.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..14e7404 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,37 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if eq $.Kind "taxonomyTerm" -}} +{{- $pages = $pctx.Pages -}} +{{- else -}} +{{- $pages = $pctx.RegularPages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- $postSections := ($.Param "postSections" | default (slice "posts")) }} +{{- $pages := ( where $pages "Type" "in" $postSections ) }} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + {{ with .Site.LanguageCode }}{{.}}{{end}} + {{ with .Site.Copyright }}{{.}}{{end}} + {{ if not .Date.IsZero }}{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ range $pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .Permalink }} + {{ partialCached "cleanedContent.xml" . .Permalink }} + + {{ end }} + + \ No newline at end of file diff --git a/layouts/_default/section.podcast.xml b/layouts/_default/section.podcast.xml new file mode 100644 index 0000000..6a8b69f --- /dev/null +++ b/layouts/_default/section.podcast.xml @@ -0,0 +1,41 @@ +{{- printf "" | safeHTML }} + + + {{ .Title }} + {{ .Permalink }} + {{ with .OutputFormats.Get "PODCAST" }}{{ printf "" .Permalink .MediaType | safeHTML }}{{ end }} + {{ .Summary | truncate 4000 ""}} + {{ .Summary | truncate 4000 ""}} + {{ with .Site.LanguageCode }}{{.}}{{end}} + {{ with .Site.Copyright }}{{.}}{{end}} + {{ dateFormat "Mon, 2 Jan 2006 15:04:05 -0700" .Lastmod }} + {{ .Site.Author.name }} + episodic + + {{ .Site.Author.name }} + {{ .Params.podcast.email }} + + + + {{ .Params.podcast.image }} + {{ .Title }} + {{ .Permalink }} + + + {{ .Params.explicit | default "no" }} + {{ range .RegularPages }} + + {{ .Title }} + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ if .Params.guid }}{{ .Params.guid }}{{ else }}{{ .Permalink }}{{ end }} + {{ .Site.Author.name }} + {{ .Summary | plainify }} + {{ .Summary | plainify }} + {{ "" | safeHTML}} + + + {{ end }} + + diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..e3f70c2 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,27 @@ +{{ define "main" }} +
+
+ {{ with .Title }} +

{{ . }}

+ {{ end }} + {{ if not .Params.nometa }} + {{ partial "post_meta" . }} + {{ partial "post_actions" . }} + {{ end }} + {{ partial "oldcontentwarning" . }} +
+ {{ with .Params.audio }} + + {{ end }} + {{ .Content }} + {{ with .Params.externalUrl }} +

{{ . }}

+ {{ end }} +
+ {{ partial "post_tags" . }} +
+ {{ if (.Param "authorbox") }}{{ partialCached "authorbox" . }}{{ end }} +
+{{ partial "related" . }} +{{ partial "mentions" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml new file mode 100644 index 0000000..87318bb --- /dev/null +++ b/layouts/_default/sitemap.xml @@ -0,0 +1,22 @@ +{{ printf "" | safeHTML }} + + {{ range .Data.Pages }}{{ if not .Params.robotsdisallow }} + + {{ .Permalink }}{{ if not .Lastmod.IsZero }} + {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} + {{ . }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }}{{ range .Translations }} + {{ end }} + {{ end }} + + {{ end }}{{ end }} + \ No newline at end of file diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..48a0641 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,8 @@ +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ if not .Params.nometa }} + {{ partialCached "summary_meta" . .Permalink }} + {{ end }} +

{{ .Summary }}

+

{{ T "read_more" }}

+
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..1be40b4 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,12 @@ +{{ define "main" }} +
+ {{ with .Content }}{{ . }}{{ end }} + {{ $postSections := ($.Param "postSections" | default (slice "posts")) }} + {{ $paginator := .Paginate ( where .Site.RegularPages "Type" "in" $postSections ) }} + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + {{ partial "pagination" . }} + {{ if (.Param "authorbox") }}{{ partialCached "authorbox" . }}{{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/authorbox.html b/layouts/partials/authorbox.html new file mode 100644 index 0000000..576c9b0 --- /dev/null +++ b/layouts/partials/authorbox.html @@ -0,0 +1,14 @@ +{{ with .Site.Author }} +
+ {{ if .avatar }} + + {{ end }} + {{ if .name }} + {{ if .link }} + {{ .name }} + {{ else }} + {{ .name }} + {{ end }} + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/cleanedContent.json b/layouts/partials/cleanedContent.json new file mode 100644 index 0000000..8653b9a --- /dev/null +++ b/layouts/partials/cleanedContent.json @@ -0,0 +1 @@ +{{ (( htmlUnescape .Content | safeHTML ) | replaceRE "href=\"/([^\"]*)\"" ( printf "href=\"%s$1\"" ( "" | absURL ) ) ) | jsonify }} \ No newline at end of file diff --git a/layouts/partials/cleanedContent.xml b/layouts/partials/cleanedContent.xml new file mode 100644 index 0000000..f5b5af2 --- /dev/null +++ b/layouts/partials/cleanedContent.xml @@ -0,0 +1 @@ +{{ (( htmlUnescape .Content | safeHTML ) | replaceRE "href=\"/([^\"]*)\"" ( printf "href=\"%s$1\"" ( "" | absURL ) ) ) | html }} \ No newline at end of file diff --git a/layouts/partials/custombodyend.html b/layouts/partials/custombodyend.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/customhead.html b/layouts/partials/customhead.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..c01c75e --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,13 @@ +
+ {{ if .Site.Menus.footer }} + + {{ end }} +

© {{ now.Format "2006" }} {{ .Site.Params.copyright | default .Site.Title }}

+
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..9282b82 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,7 @@ +
+

+ {{ .Site.Title }} +

+ {{ with .Site.Params.subtitle }}

{{ . }}

{{ end }} + {{ partialCached "menu" . }} +
\ No newline at end of file diff --git a/layouts/partials/indiewebhead.html b/layouts/partials/indiewebhead.html new file mode 100644 index 0000000..84ce350 --- /dev/null +++ b/layouts/partials/indiewebhead.html @@ -0,0 +1,17 @@ +{{- if .Param "indieweb.enabled" }} +{{- with .Param "indieweb.endpoints.webmention" }} + +{{- end }} +{{- with .Param "indieweb.endpoints.pingback" }} + +{{- end }} +{{- with .Param "indieweb.endpoints.auth_endpoint" }} + +{{- end }} +{{- with .Param "indieweb.endpoints.token_endpoint" }} + +{{- end }} +{{- with .Param "indieweb.endpoints.micropub" }} + +{{- end }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/list_meta.html b/layouts/partials/list_meta.html new file mode 100644 index 0000000..87a4cb1 --- /dev/null +++ b/layouts/partials/list_meta.html @@ -0,0 +1,5 @@ +{{ if .IsTranslated }} +
+ {{ i18n "translations" }}: {{ $delimiter := "" }}{{ range .Translations }}{{ $delimiter }}{{ .Language.LanguageName }}{{ $delimiter = ", " }}{{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/mentions.html b/layouts/partials/mentions.html new file mode 100644 index 0000000..b3b3c61 --- /dev/null +++ b/layouts/partials/mentions.html @@ -0,0 +1,30 @@ +{{ if .Param "indieweb.enabled" }} +{{ if not (.Param "indieweb.hidewmform") }} +{{ if .Param "indieweb.endpoints.webmention" }} +{{ $md5pl := md5 (replace .Permalink "/" "") }} +{{ $mentions := index .Site.Data.mentions $md5pl }} +{{ $dateFormat := ( .Site.Params.dateformat | default "January 02, 2006") }} +
+ {{ T "interactions" }} + {{ with $mentions }} +
    + {{ range sort . ".date" "asc" }}{{ $sourceUrl := urls.Parse .source }} +
  • {{ $sourceUrl.Host }} {{ dateFormat $dateFormat .date }}
  • + {{ end }} +
+ {{ end }} +
+ + + +
+
+ +
+
+{{ end }} +{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html new file mode 100644 index 0000000..f0c2f36 --- /dev/null +++ b/layouts/partials/menu.html @@ -0,0 +1,6 @@ +{{ if .Site.Menus.main }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/oldcontentwarning.html b/layouts/partials/oldcontentwarning.html new file mode 100644 index 0000000..e575557 --- /dev/null +++ b/layouts/partials/oldcontentwarning.html @@ -0,0 +1,7 @@ +{{ if .Param "oldcontentwarning" }} +{{ if .Date }} +{{ if (.Date.AddDate 1 0 0).Before now }} +

{{ ":warning:" | emojify }} {{ T "oldcontent" }}

+{{ end }} +{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..e37cc35 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,11 @@ +{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} +
+ {{ with .Paginator.Prev }} +
  + {{ end }} + + {{ with .Paginator.Next }} +  
+ {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/post_actions.html b/layouts/partials/post_actions.html new file mode 100644 index 0000000..fe0f203 --- /dev/null +++ b/layouts/partials/post_actions.html @@ -0,0 +1,16 @@ +{{ if or (.Param "shareLink") (and ((.Param "subscribeBtn") (.Param "subscribeLink"))) (.Param "speak") }} +
+ {{ if (.Param "shareLink") }} +
  + {{ end }} + {{ if and ((.Param "subscribeBtn") (.Param "subscribeLink")) }} +
  + {{ end }} + {{ if (.Param "speak") }} + + {{ $speakScript := resources.Get "js/speak.js" | minify | fingerprint }} + + + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html new file mode 100644 index 0000000..eaf447b --- /dev/null +++ b/layouts/partials/post_meta.html @@ -0,0 +1,20 @@ +
+ {{ if not .Date.IsZero }} +
{{ if not (eq .FirstSection.RelPermalink .RelPermalink) }} in {{ .FirstSection.Title }}{{ end }}
+ {{ end }} + {{ if ne .Date .Lastmod }} +
+ {{ end }} + {{ with .Param "indieweb.reply" }}{{ if .link }} +
{{ T "meta_reply_to" }}: {{ .title | default .link }}
+ {{ end }}{{ end }} + {{ with .Param "indieweb.like" }}{{ if .link }} +
{{ T "meta_like_of" }}: {{ .title | default .link }}
+ {{ end }}{{ end }} + {{ with .Param "syndicate" }} +
{{ T "also_on" }}:{{ $delimiter := "" }}{{ range $index, $link := . }}{{ $delimiter }} {{ (urls.Parse $link).Host }}{{ $delimiter = "," }}{{ end }}
+ {{ end }} + {{ if .IsTranslated }} +
{{ i18n "translations" }}: {{ $delimiter := "" }}{{ range .Translations }}{{ $delimiter }}{{ .Language.LanguageName }}{{ $delimiter = ", " }}{{ end }}
+ {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/post_tags.html b/layouts/partials/post_tags.html new file mode 100644 index 0000000..c6a927d --- /dev/null +++ b/layouts/partials/post_tags.html @@ -0,0 +1,14 @@ +{{ if or (.GetTerms "tags") (.GetTerms "series") }} +

+ {{ with (.GetTerms "series") }} + {{ range sort . "Pages" "desc" }} + {{ len .Pages }} + {{ end }} + {{ end }} + {{ with (.GetTerms "tags") }} + {{ range sort . "Pages" "desc" }} + {{ len .Pages }} + {{ end }} + {{ end }} +

+{{ end }} \ No newline at end of file diff --git a/layouts/partials/related.html b/layouts/partials/related.html new file mode 100644 index 0000000..20ddb0f --- /dev/null +++ b/layouts/partials/related.html @@ -0,0 +1,11 @@ +{{ $related := .Site.RegularPages.Related . | first 5 }} +{{ with $related }} +
+ {{ T "related" }} + +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/styles.html b/layouts/partials/styles.html new file mode 100644 index 0000000..b6a25c2 --- /dev/null +++ b/layouts/partials/styles.html @@ -0,0 +1,6 @@ +{{ $styles := resources.Get "css/style.scss" | toCSS | minify | fingerprint }} +{{ if .Site.Params.inlinecss }} + +{{ else }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/summary_meta.html b/layouts/partials/summary_meta.html new file mode 100644 index 0000000..873122a --- /dev/null +++ b/layouts/partials/summary_meta.html @@ -0,0 +1,21 @@ +
+ {{ if not .Date.IsZero }} +
{{ if not (eq .FirstSection.RelPermalink .RelPermalink) }} in {{ .FirstSection.Title }}{{ end }}
+ {{ end }} + {{ if ne .Date .Lastmod }} +
+ {{ end }} + {{ with .Param "indieweb.reply" }} + {{ if .link }} +
{{ T "meta_reply_to" }}: {{ .title | default .link }}
+ {{ end }} + {{ end }} + {{ with .Param "indieweb.like" }} + {{ if .link }} +
{{ T "meta_like_of" }}: {{ .title | default .link }}
+ {{ end }} + {{ end }} + {{ if .IsTranslated }} +
{{ i18n "translations" }}: {{ $delimiter := "" }}{{ range .Translations }}{{ $delimiter }}{{ .Language.LanguageName }}{{ $delimiter = ", " }}{{ end }}
+ {{ end }} +
\ No newline at end of file diff --git a/layouts/photos/list.html b/layouts/photos/list.html new file mode 100644 index 0000000..8d16d14 --- /dev/null +++ b/layouts/photos/list.html @@ -0,0 +1,14 @@ +{{ define "main" }} +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ if not .Params.nometa }}{{ partial "list_meta" . }}{{ end }} + {{ with .Content }}{{ . }}{{ end }} + {{ $photoSections := (.Site.Param "photoSections" | default (slice "posts")) }} + {{ $paginator := .Paginate ( where ( where .Site.RegularPages "Type" "in" $photoSections ) "Params.images" "!=" nil ) 5 }} + {{ range $paginator.Pages }} + {{ .Render "photosummary" }} + {{ end }} + {{ if (.Param "authorbox") }}{{ partialCached "authorbox" . }}{{ end }} +
+{{ partial "pagination" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/robots.txt b/layouts/robots.txt new file mode 100644 index 0000000..8b90f46 --- /dev/null +++ b/layouts/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +{{- range where .Site.RegularPages "Params.robotsdisallow" true }} +Disallow: {{ .RelPermalink }}{{end}} +Sitemap: {{ "sitemap.xml" | absLangURL }} \ No newline at end of file diff --git a/layouts/tags/terms.html b/layouts/tags/terms.html new file mode 100644 index 0000000..a9adc33 --- /dev/null +++ b/layouts/tags/terms.html @@ -0,0 +1,12 @@ +{{ define "main" }} +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ if not .Params.nometa }}{{ partial "list_meta" . }}{{ end }} +

+ {{ range (.Paginate ( .Pages.ByTitle ) 1000).Pages }} + {{ .Title }}{{ len .Pages }} + {{ end }} +

+
+{{ partial "pagination" . }} +{{ end }} \ No newline at end of file diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..7b543f2 --- /dev/null +++ b/theme.toml @@ -0,0 +1,11 @@ +name = "Indiego" +license = "Unlicense" +licenselink = "https://git.jlel.se/jlelse/Indiego/raw/branch/master/LICENSE.md" +description = "jlelse's personal Hugo theme" +homepage = "https://git.jlel.se/jlelse/Indiego" +tags = [] +features = [] + +[author] + name = "Jan-Lukas Else" + homepage = "https://jlelse.dev" \ No newline at end of file