From ad722314595cd29dc9b9d7c38f561e5125e39f62 Mon Sep 17 00:00:00 2001 From: jtbx Date: Thu, 5 Oct 2023 23:02:20 +0200 Subject: [PATCH] Blog: Fix categories, blog single page template --- README.md | 4 +-- content/blog/_index.md | 2 -- content/blog/test-event-future.md | 10 +++--- content/blog/test-event-future2.md | 9 +++-- content/blog/test-event.md | 12 ++++--- content/blog/test-post.md | 8 ++--- content/categories/article/_index.md | 3 ++ content/categories/event/_index.md | 3 ++ hugo.toml | 9 +++++ themes/ccchh/archetypes/article.md | 5 ++- themes/ccchh/archetypes/event.md | 6 +++- themes/ccchh/assets/sass/main.scss | 42 +++++++++++++++++++++++ themes/ccchh/layouts/_default/list.html | 16 +++++++++ themes/ccchh/layouts/_default/single.html | 6 ++-- themes/ccchh/layouts/blog/list.html | 28 +++++++-------- themes/ccchh/layouts/blog/single.html | 35 +++++++++++++++++++ themes/ccchh/layouts/index.html | 2 +- 17 files changed, 157 insertions(+), 43 deletions(-) create mode 100644 content/categories/article/_index.md create mode 100644 content/categories/event/_index.md create mode 100644 themes/ccchh/layouts/_default/list.html create mode 100644 themes/ccchh/layouts/blog/single.html diff --git a/README.md b/README.md index 763bc08..eba84e7 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Events will be shown on the home page from their publishing date until they have To create a new event blog post, run a command like this: ```shell -hugo new content --king event blog/your-event-title.md +hugo new content --kind event blog/your-event-title.md ``` #### Add a Blog Entry @@ -59,7 +59,7 @@ They will only be shown in the "blog" section and posted to the RSS feeds. To create a new general blog post, run a command like this: ```shell -hugo new content --king article blog/your-article-title.md +hugo new content --kind article blog/your-article-title.md ``` ### Icons diff --git a/content/blog/_index.md b/content/blog/_index.md index 4c429de..b7e6313 100644 --- a/content/blog/_index.md +++ b/content/blog/_index.md @@ -3,5 +3,3 @@ title: "Blog" draft: false menu: main --- - -TODO: Provide filters by type (announcement, post) diff --git a/content/blog/test-event-future.md b/content/blog/test-event-future.md index b74e8db..917a838 100644 --- a/content/blog/test-event-future.md +++ b/content/blog/test-event-future.md @@ -1,13 +1,13 @@ --- -kind: event +categories: event title: "Test Event Future" date: 2023-12-30T09:03:20+02:00 # date of the event publishDate: 2023-08-27T09:03:20+02:00 # when to publish draft: false -keywords: - - foo - - bar -categories: announcement +location: Z9 +authors: + - jtbx + - Ada Lovelace --- This is **bold** text, and this is *emphasized* text. diff --git a/content/blog/test-event-future2.md b/content/blog/test-event-future2.md index bf985e6..29e2995 100644 --- a/content/blog/test-event-future2.md +++ b/content/blog/test-event-future2.md @@ -1,13 +1,12 @@ --- -kind: event +categories: event title: "Test Event Future 2" date: 2023-12-03T09:03:20+02:00 # date of the event publishDate: 2023-09-27T09:03:20+02:00 # when to publish draft: false -keywords: - - foo - - bar -categories: announcement +location: Z9 +tags: + - test --- This is **bold** text, and this is *emphasized* text. diff --git a/content/blog/test-event.md b/content/blog/test-event.md index 9aaa076..bc583aa 100644 --- a/content/blog/test-event.md +++ b/content/blog/test-event.md @@ -1,13 +1,15 @@ --- -kind: event +categories: event title: "Test Event" date: 2023-09-20T09:03:20+02:00 # date of the event publishDate: 2023-09-20T09:03:20+02:00 # when to publish draft: false -keywords: - - foo - - bar -categories: announcement +location: Z9 +authors: + - jtbx + - Ada Lovelace +tags: + - test --- This is **bold** text, and this is *emphasized* text. diff --git a/content/blog/test-post.md b/content/blog/test-post.md index ba9a0f0..50931a4 100644 --- a/content/blog/test-post.md +++ b/content/blog/test-post.md @@ -1,13 +1,13 @@ --- -kind: article +categories: article title: "Test Blogpost" date: 2023-08-20T09:03:20+02:00 draft: false -keywords: +authors: + - your name +tags: - foo - bar -categories: -- article --- This is **bold** text, and this is *emphasized* text. diff --git a/content/categories/article/_index.md b/content/categories/article/_index.md new file mode 100644 index 0000000..f2c2eef --- /dev/null +++ b/content/categories/article/_index.md @@ -0,0 +1,3 @@ +--- +title: Blogeintrag +--- \ No newline at end of file diff --git a/content/categories/event/_index.md b/content/categories/event/_index.md new file mode 100644 index 0000000..75ec619 --- /dev/null +++ b/content/categories/event/_index.md @@ -0,0 +1,3 @@ +--- +title: Eventankündigung +--- \ No newline at end of file diff --git a/hugo.toml b/hugo.toml index 7207873..504f40b 100644 --- a/hugo.toml +++ b/hugo.toml @@ -3,6 +3,15 @@ languageCode = 'de-de' title = 'CCC Hansestadt Hamburg e.V.' theme = 'ccchh' +[taxonomies] + category = 'categories' + tag = 'tags' + author = 'authors' + +[frontmatter] + lastmod = [':git', ':fileModTime', 'lastmod', 'modified', 'publishdate', 'pubdate', 'published', 'date'] + + [menu] [[menu.main]] name = "Wiki" diff --git a/themes/ccchh/archetypes/article.md b/themes/ccchh/archetypes/article.md index 8aa30b2..8bd575d 100644 --- a/themes/ccchh/archetypes/article.md +++ b/themes/ccchh/archetypes/article.md @@ -1,8 +1,11 @@ --- -kind: article +categories: article title: '{{ replace .File.ContentBaseName `-` ` ` | title }}' date: '{{ .Date }}' draft: true +authors: + - your name +# tags: --- TODO: Write your blog post diff --git a/themes/ccchh/archetypes/event.md b/themes/ccchh/archetypes/event.md index 287f8ec..3a2010a 100644 --- a/themes/ccchh/archetypes/event.md +++ b/themes/ccchh/archetypes/event.md @@ -1,9 +1,13 @@ --- -kind: event +categories: event title: '{{ replace .File.ContentBaseName `-` ` ` | title }}' date: '{{ .Date }}' # date of the event publishDate: '{{ .Date }}' # when to publish draft: true +location: Z9 +authors: + - your name +# tags: --- TODO: Describe your event here diff --git a/themes/ccchh/assets/sass/main.scss b/themes/ccchh/assets/sass/main.scss index 3de3c01..969eaf9 100644 --- a/themes/ccchh/assets/sass/main.scss +++ b/themes/ccchh/assets/sass/main.scss @@ -3,6 +3,35 @@ $roomstate_color_open: var(--ins-color); $roomstate_color_closed: var(--del-color); +// General Customizations +header { + margin-bottom: 3rem; + + h1 { + margin-bottom: 0; + } +} + +body>footer { + padding-top: var(--spacing); + padding-bottom: var(--spacing); +} + +body>main { + padding-bottom: var(--spacing); +} + +.li-comma { + &::after { + content: ", "; + } + + &:last-child::after { + content: ""; + } +} + + // Room State in Menu #roomstate { font-size: 0.9em; @@ -75,4 +104,17 @@ $roomstate_color_closed: var(--del-color); margin: 0 auto; } } +} + +// Blog Overview: Categories list +div.nav-aside { + ul { + display: inline; + padding: 0; + + li { + text-decoration: none; + display: inline; + } + } } \ No newline at end of file diff --git a/themes/ccchh/layouts/_default/list.html b/themes/ccchh/layouts/_default/list.html new file mode 100644 index 0000000..e8eb091 --- /dev/null +++ b/themes/ccchh/layouts/_default/list.html @@ -0,0 +1,16 @@ +{{ define "main" }} +
+
+

{{ .Title }}

+
+ + +
+{{ end }} diff --git a/themes/ccchh/layouts/_default/single.html b/themes/ccchh/layouts/_default/single.html index b3d580c..acbb255 100644 --- a/themes/ccchh/layouts/_default/single.html +++ b/themes/ccchh/layouts/_default/single.html @@ -6,8 +6,10 @@ {{ . }} {{ end }} -
+ +
{{ .Content }} -
+ + {{ end }} diff --git a/themes/ccchh/layouts/blog/list.html b/themes/ccchh/layouts/blog/list.html index 311f660..10d832f 100644 --- a/themes/ccchh/layouts/blog/list.html +++ b/themes/ccchh/layouts/blog/list.html @@ -5,29 +5,27 @@ {{ with .Params.subtitle }} {{ . }} {{ end }} + + -
- {{ .Content }} -
- - {{ range .Pages.GroupByParam "kind" }} -

{{ .Key }}

- - {{ end }} {{ end }} diff --git a/themes/ccchh/layouts/blog/single.html b/themes/ccchh/layouts/blog/single.html new file mode 100644 index 0000000..69ab5c1 --- /dev/null +++ b/themes/ccchh/layouts/blog/single.html @@ -0,0 +1,35 @@ +{{ define "main" }} +
+
+

{{ .Title }}

+ {{- with .Params.subtitle }} + {{ . }} + {{- end }} + +
+ {{ .Date.Format "2006-01-02 15:04" }} + {{- with .Params.location }}, + {{ . }} + {{- end }} +
+ {{- if .Params.authors }} + + {{ range .Params.authors }}{{ . }}{{ end }} + {{- end }} +
+
+ +
+ {{ .Content }} +
+ +
+ {{- with .Params.publishDate }} + Veröffentlicht: {{ .Format "2006-01-02 15:04" }} + {{- end }} + {{- with .Params.lastmod }} + letzte Änderung: {{ .Format "2006-01-02 15:04" }} + {{- end }} +
+
+{{ end }} diff --git a/themes/ccchh/layouts/index.html b/themes/ccchh/layouts/index.html index 77379ce..82dd1cd 100644 --- a/themes/ccchh/layouts/index.html +++ b/themes/ccchh/layouts/index.html @@ -11,7 +11,7 @@ {{ .Content }} - {{- $events := where (.Site.GetPage "blog").Pages ".Params.kind" "event" }} + {{- $events := where (.Site.GetPage "blog").Pages ".Params.categories" "event" }} {{- $upcoming := where $events ".Params.date" "ge" now }} {{ if $upcoming}}