From 9f594273c05fcb73d06ff92607a8bddb5d0173fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Duje=20Mihanovi=C4=87?= <duje.mihanovic@skole.hr> Date: Sat, 24 Aug 2024 16:44:26 +0200 Subject: [PATCH] Decouple theme from content Probably still some work to do in this direction (including fully adapting the theme for reuse by others), but I believe this does the bulk of it. --- .gitmodules | 2 +- archetypes/default.md | 6 ------ content/posts/_index.md | 4 ---- hugo.toml | 1 + layouts/_default/list.html | 14 -------------- layouts/_default/single.html | 3 --- layouts/index.html | 17 ----------------- layouts/partials/head.html | 10 ---------- layouts/partials/nav.html | 8 -------- layouts/posts/list.html | 15 --------------- layouts/posts/single.html | 12 ------------ layouts/projects/list.html | 10 ---------- layouts/projects/single.html | 4 ---- layouts/rss.xml | 34 ---------------------------------- themes/duje | 2 +- 15 files changed, 3 insertions(+), 139 deletions(-) delete mode 100644 archetypes/default.md delete mode 100644 content/posts/_index.md delete mode 100644 layouts/_default/list.html delete mode 100644 layouts/_default/single.html delete mode 100644 layouts/index.html delete mode 100644 layouts/partials/head.html delete mode 100644 layouts/partials/nav.html delete mode 100644 layouts/posts/list.html delete mode 100644 layouts/posts/single.html delete mode 100644 layouts/projects/list.html delete mode 100644 layouts/projects/single.html delete mode 100644 layouts/rss.xml diff --git a/.gitmodules b/.gitmodules index f9597ba..ba46698 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "themes/duje"] path = themes/duje - url = ./ + url = git://git.dujemihanovic.xyz/hugo-skeleton.git diff --git a/archetypes/default.md b/archetypes/default.md deleted file mode 100644 index 00e77bd..0000000 --- a/archetypes/default.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "{{ replace .Name "-" " " | title }}" -date: {{ .Date }} -draft: true ---- - diff --git a/content/posts/_index.md b/content/posts/_index.md deleted file mode 100644 index a7721e4..0000000 --- a/content/posts/_index.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Blog ---- -# Posts diff --git a/hugo.toml b/hugo.toml index 9fe3844..7359a24 100644 --- a/hugo.toml +++ b/hugo.toml @@ -4,6 +4,7 @@ title = "Duje MihanoviÄ's Site" enableGitInfo = true disableKinds = ['taxonomy', 'term'] rssLimit = 20 +theme = ['duje'] [author] name = 'Duje MihanoviÄ' email = 'duje.mihanovic@skole.hr' diff --git a/layouts/_default/list.html b/layouts/_default/list.html deleted file mode 100644 index ec936f4..0000000 --- a/layouts/_default/list.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ define "main" }} -{{ .Content }} -{{ end }} - -{{ define "footer" }} -<footer> - <p>If you appreciate my work and would like to donate, you can donate XMR to this address or use the QR code below.</p> - <p>85qXBHh99bJ62p7s8upmoqYsvHrJvZWLTD7riHFo3E2jRvdQRoiNuXKRaDMAQiJ34Kfix3KHouNCW6bbD4zniWB5QxZR9Xx</p> - {{ $image := resources.Get "img/donate.png" }} - {{ with $image }} - <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="QR code for XMR donation"> - {{ end }} -</footer> -{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html deleted file mode 100644 index 8e99f87..0000000 --- a/layouts/_default/single.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} - {{ .Content }} -{{ end }} diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index 9cfa2d0..0000000 --- a/layouts/index.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ define "main" }} -{{ .Content }} -<h2>Recent Posts</h2> -<ul> - {{ range first 5 ($.Site.GetPage "/posts").Pages }} - <li><a href="{{ .RelPermalink }}">{{ .Title }}</a> - {{ .Date.Format "January 2, 2006" }}</li> - {{ end }} -</ul> -<ul style="list-style: none;"><li><a href="/posts">Read all the posts</a></li></ul> -<h2>Recently Updated Projects</h2> -<ul> - {{ range first 3 ($.Site.GetPage "/projects").Pages }} - <li><a href="{{ .RelPermalink }}">{{ .Title }}</a> - {{ end }} -</ul> -<ul style="list-style: none;"><li><a href="/projects">See all the projects</a></li></ul> -{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html deleted file mode 100644 index 15dd634..0000000 --- a/layouts/partials/head.html +++ /dev/null @@ -1,10 +0,0 @@ -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width, initial-scale=1"> -<meta name="description" content="Duje MihanoviÄ's personal website"> -<title>{{ print .Page.Title }} | {{ print .Site.Title }}</title> -{{ $style := resources.Get "css/style.css" | resources.Minify }} -<link rel="stylesheet" href="{{ $style.RelPermalink }}?v=1.1.3"> -{{ $index := $.Site.GetPage "/" }} -{{ range $index.AlternativeOutputFormats }} -{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} -{{ end }} diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html deleted file mode 100644 index cf8baab..0000000 --- a/layouts/partials/nav.html +++ /dev/null @@ -1,8 +0,0 @@ -<nav> - <ul> - <li><a href="/">Home</a></li> - <li><a href="/posts/">Blog</a></li> - <li><a href="/contact/">Contact</a></li> - <li><a href="/donate/">Donate</a></li> - </ul> -</nav> diff --git a/layouts/posts/list.html b/layouts/posts/list.html deleted file mode 100644 index 2536415..0000000 --- a/layouts/posts/list.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ define "main" }} -{{ .Content }} -<ul> -{{ range .Pages }} - <li> - <a href="{{ .RelPermalink }}">{{ .Title }}</a> - {{ .Date.Format "January 2, 2006" }} - {{ .ReadingTime }} minute read<br> - {{ .Summary }} - {{ if .Truncated }} - <br> - <a href="{{ .RelPermalink }}">Read full article...</a> - {{ end }} - </li> -{{ end }} -</ul> -{{ end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html deleted file mode 100644 index e49cbb0..0000000 --- a/layouts/posts/single.html +++ /dev/null @@ -1,12 +0,0 @@ -{{ define "main" }} - <h1>{{ .Title }}</h1> - <p><i>{{ .WordCount }} words, estimated reading time: {{ .ReadingTime }} - minute(s)</i> - <br> - <i>Originally published on {{ .PublishDate.Format "January 2, 2006" - }}</i> - <br> - <i>Last modified on {{ .Lastmod.Format "January 2, 2006" }}</i></p> - <p></p> - {{ .Content }} -{{ end }} diff --git a/layouts/projects/list.html b/layouts/projects/list.html deleted file mode 100644 index 9e32e3f..0000000 --- a/layouts/projects/list.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ define "main" }} -{{ .Content }} -<ul> -{{ range .Pages }} - <li> - <a href="{{ .RelPermalink }}">{{ .Title }}</a> - </li> -{{ end }} -</ul> -{{ end }} diff --git a/layouts/projects/single.html b/layouts/projects/single.html deleted file mode 100644 index 17b274b..0000000 --- a/layouts/projects/single.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ define "main" }} -<h1>{{ .Title }}</h1> -{{ .Content }} -{{ end }} diff --git a/layouts/rss.xml b/layouts/rss.xml deleted file mode 100644 index 4c0def8..0000000 --- a/layouts/rss.xml +++ /dev/null @@ -1,34 +0,0 @@ -{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }} -<feed xmlns="http://www.w3.org/2005/Atom"> - <title>{{ .Site.Title }}</title> - <id>{{ .Permalink }}</id> - {{ $lastmod := 0 }} - {{ range (.Site.GetPage "/posts").Pages }} - {{ if gt .Lastmod $lastmod }} - {{ $lastmod = .Lastmod }} - {{ end }} - {{ end }} - <updated>{{ $lastmod.Format "2006-01-02T15:04:05Z" }}</updated> - <link href="{{ .Permalink }}"/> - <link rel="self" href="{{ (.OutputFormats.Get "RSS").Permalink }}"/> - <author> - <name>Duje MihanoviÄ</name> - <email>duje.mihanovic@skole.hr</email> - <uri>{{ .Permalink }}</uri> - </author> - <generator uri="https://gohugo.io/">Hugo</generator> - - {{ with $.Site.GetPage "posts/" }} - {{ range first .Site.Config.Services.RSS.Limit .Pages }} - <entry> - <id>{{ .Permalink }}</id> - <link rel="alternate" href="{{ .RelPermalink }}"/> - <title>{{ .Title }}</title> - <updated>{{ .Lastmod.Format "2006-01-02T15:04:05Z" }}</updated> - <published>{{ .PublishDate.Format "2006-01-02T15:04:05Z" }}</published> - <content type="html">{{ .Content | html }}</content> - <summary type="html">{{ .Summary | html }}</summary> - </entry> - {{ end }} - {{ end }} -</feed> diff --git a/themes/duje b/themes/duje index 558981b..f0f84ba 160000 --- a/themes/duje +++ b/themes/duje @@ -1 +1 @@ -Subproject commit 558981b134086fe06af090c147bac1a5f981dab9 +Subproject commit f0f84ba4f81b753ed494af4e950cd546c17b426a -- 2.39.5