diff options
author | pavel <pavel.post@deutschebahn.com> | 2020-04-11 23:11:12 +0300 |
---|---|---|
committer | pavel <pavel.post@deutschebahn.com> | 2020-04-11 23:11:12 +0300 |
commit | 9bfb62340332d8ee5ef0dab996f5a60b683f7ff0 (patch) | |
tree | ca0b5f2d86d6f9586e21e4c9aa5134c43adeba1f | |
parent | 521baede571e83aa977f0b157abbeda22c8864ce (diff) |
created sections for "blog" and "micro"
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | archetypes/default.md | 3 | ||||
-rw-r--r-- | archetypes/micro.md | 8 | ||||
-rw-r--r-- | archetypes/page.md | 6 | ||||
-rw-r--r-- | layouts/_default/list.html | 22 | ||||
-rw-r--r-- | layouts/blog/list.html | 71 | ||||
-rw-r--r-- | layouts/micro/list.html | 71 |
7 files changed, 158 insertions, 41 deletions
@@ -38,27 +38,17 @@ To change the behaviour of how related articles are generated, check [official d ## Creating Articles -There are three types of posts: -* blog posts (type: `article`) -* microblog posts (type: `micro`) -* info pages such as *about* (type: `page`) -Per default, new posts will be of type `article`: +Create a new blog post: ``` -$ hugo new my-first-post.md +$ hugo new blog/my-first-blog-post.md ``` -In order to create a new post for the microblog you will need to specify the `micro` type: +Create a new microblog post: ``` -$ hugo new -k micro my-first-microblog-post.md -``` - -In order to create a new info page: - -``` -$ hugo new -k page about.md +$ hugo new micro/my-first-microblog-post.md ``` ## License diff --git a/archetypes/default.md b/archetypes/default.md index 1305ef1..17a3207 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -2,7 +2,4 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} draft: true -type: article --- - -Default
\ No newline at end of file diff --git a/archetypes/micro.md b/archetypes/micro.md deleted file mode 100644 index b48618f..0000000 --- a/archetypes/micro.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "{{ replace .TranslationBaseName "-" " " | title }}" -date: {{ .Date }} -draft: true -type: micro ---- - -Micro
\ No newline at end of file diff --git a/archetypes/page.md b/archetypes/page.md deleted file mode 100644 index c728497..0000000 --- a/archetypes/page.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "{{ replace .TranslationBaseName "-" " " | title }}" -type: page ---- - -Page
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8755d08..238f126 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -11,10 +11,10 @@ <div class ="container"> - <h2 class="areatitle">{{ i18n "microblog_title" }}</h2> + <a href="/micro"><h2 class="areatitle">{{ i18n "microblog_title" }}</h2></a> <!-- show "number" of latest "micro" type articles --> - {{ range first .Site.Params.microblog.number (where .Data.Pages.ByDate.Reverse "Type" "micro") }} + {{ range first .Site.Params.microblog.number (where .Site.RegularPages.ByDate.Reverse "Type" "in" "micro") }} <!-- Article Tags --> <div class="subtitle tags is-6 is-pulled-right"> @@ -52,11 +52,11 @@ <div class="container"> - <h2 class="areatitle">{{ i18n "blog_title" }}</h2> - <!--<h2 class="areatitle">AKTUELLE BEITRÄGE</h2>--> + + <a href="/blog"><h2 class="areatitle">{{ i18n "blog_title" }}</h2></a> <!-- Loop through all posts filtered by type "article" --> - {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "article") }} + {{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Type" "in" "blog") }} {{ range .Paginator.Pages }} <article> @@ -72,11 +72,11 @@ {{if not .Date.IsZero }} <h2 class="subtitle is-6"> <!-- Consider german month names --> - {{if eq .Site.Params.defaultContentLanguage "de" }} - {{ .Date.Day }}. {{ index $.Site.Data.monate (printf "%d" .Date.Month) }} {{ .Date.Year }}, {{ .Date.Format "15:04" }} - {{ else }} - {{ .Date.Format "January 2, 2006 | 15:04" }} - {{ end }} + {{if eq .Site.Language.Lang "de" }} + {{ .Date.Day }}. {{ index $.Site.Data.monate (printf "%d" .Date.Month) }} {{ .Date.Year }}, {{ .Date.Format "15:04" }} + {{ else }} + {{ .Date.Format "January 2, 2006 | 15:04" }} + {{ end }} </h2> {{ end }} @@ -105,6 +105,8 @@ </section> + + <!-- "Older Posts" / "Newer Posts" Buttons --> {{ partial "page-navigation" . }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html new file mode 100644 index 0000000..291d743 --- /dev/null +++ b/layouts/blog/list.html @@ -0,0 +1,71 @@ +<!-- Header --> +{{ partial "header" . }} + +<!-- Navigation --> +{{ partial "nav" . }} + + +<!-- Blog Area --> +<section class="section"> + + <div class="container"> + + <h2 class="areatitle">{{ i18n "blog_title" }}</h2> + <br> + <br> + + <!-- Loop through all posts filtered by type "article" --> + {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "in" "blog") }} + {{ range .Paginator.Pages }} + + <article> + + <!-- Article Tags --> + <div class="subtitle tags is-6 is-pulled-right"> + {{ if .Params.tags }} + {{ partial "tags" .Params.tags }} + {{ end }} + </div> + + <!-- Date above Article Title--> + {{if not .Date.IsZero }} + <h2 class="subtitle is-6"> + <!-- Consider german month names --> + {{if eq .Site.Language.Lang "de" }} + {{ .Date.Day }}. {{ index $.Site.Data.monate (printf "%d" .Date.Month) }} {{ .Date.Year }}, {{ .Date.Format "15:04" }} + {{ else }} + {{ .Date.Format "January 2, 2006 | 15:04" }} + {{ end }} + </h2> + {{ end }} + + + <!-- Article Title --> + <h1 class="title"> + <a href="{{ .Permalink }}">{{ .Title }}</a> + </h1> + + <div class="content"> + + <!-- Article Summary --> + {{ .Summary | plainify | safeHTML }} + + <!-- "Read More" Button--> + <a class="button is-link" href="{{ .Permalink }}" style="height:28px">{{ i18n "read_more" }}</a> + + </div> + + </article> + + <!-- End loop --> + {{ end }} + + </div> +</section> + + +<!-- "Older Posts" / "Newer Posts" Buttons --> +{{ partial "page-navigation" . }} + +<!-- Footer --> +{{ partial "footer" . }}
\ No newline at end of file diff --git a/layouts/micro/list.html b/layouts/micro/list.html new file mode 100644 index 0000000..5961102 --- /dev/null +++ b/layouts/micro/list.html @@ -0,0 +1,71 @@ +<!-- Header --> +{{ partial "header" . }} + +<!-- Navigation --> +{{ partial "nav" . }} + + +<!-- Blog Area --> +<section class="section"> + + <div class="container"> + + <h2 class="areatitle">{{ i18n "microblog_title" }}</h2> + <br> + <br> + + <!-- Loop through all posts filtered by type "article" --> + {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "in" "micro") }} + {{ range .Paginator.Pages }} + + <article> + + <!-- Article Tags --> + <div class="subtitle tags is-6 is-pulled-right"> + {{ if .Params.tags }} + {{ partial "tags" .Params.tags }} + {{ end }} + </div> + + <!-- Date above Article Title--> + {{if not .Date.IsZero }} + <h2 class="subtitle is-6"> + <!-- Consider german month names --> + {{if eq .Site.Language.Lang "de" }} + {{ .Date.Day }}. {{ index $.Site.Data.monate (printf "%d" .Date.Month) }} {{ .Date.Year }}, {{ .Date.Format "15:04" }} + {{ else }} + {{ .Date.Format "January 2, 2006 | 15:04" }} + {{ end }} + </h2> + {{ end }} + + + <!-- Article Title --> + <h1 class="title"> + <a href="{{ .Permalink }}">{{ .Title }}</a> + </h1> + + <div class="content"> + + <!-- Article Summary --> + {{ .Summary | plainify | safeHTML }} + + <!-- "Read More" Button--> + <a class="button is-link" href="{{ .Permalink }}" style="height:28px">{{ i18n "read_more" }}</a> + + </div> + + </article> + + <!-- End loop --> + {{ end }} + + </div> +</section> + + +<!-- "Older Posts" / "Newer Posts" Buttons --> +{{ partial "page-navigation" . }} + +<!-- Footer --> +{{ partial "footer" . }}
\ No newline at end of file |