added list page for categories
authordanix <danix@danix.xyz>
Thu, 9 Mar 2023 10:38:48 +0000 (11:38 +0100)
committerdanix <danix@danix.xyz>
Thu, 9 Mar 2023 10:38:48 +0000 (11:38 +0100)
assets/sass/components/_image.scss
assets/sass/components/_spotlights.scss
layouts/categories/list-baseof.html [new file with mode: 0644]
layouts/categories/list.html [new file with mode: 0644]
layouts/home-baseof.html
layouts/partials/footer.html
layouts/partials/header.html

index 6b6fdb3..45df867 100644 (file)
                                width: 350px;\r
                        }\r
                }\r
+       }\r
+       .section-blog {\r
+               .spotlights {\r
+                       .image {\r
+                               max-height: 20em;\r
+                               overflow: hidden;\r
+                       }\r
+               }\r
        }
\ No newline at end of file
index 882ebe4..a9e9476 100644 (file)
@@ -14,6 +14,7 @@
                }\r
 \r
                > section {\r
+                       overflow: hidden;\r
                        @include vendor('display', 'flex');\r
                        @include vendor('flex-direction', 'row');\r
                        background-color: desaturate(lighten(_palette_light(bg-alt), 2), 1);\r
diff --git a/layouts/categories/list-baseof.html b/layouts/categories/list-baseof.html
new file mode 100644 (file)
index 0000000..bfb6c1a
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="{{ $.Site.LanguageCode | default "en" }}">
+       {{- partial "head.html" . -}}
+       <body class="is-preload">
+               <a id="top" class="skip-link screen-reader-text" href="#primary">skip to content</a>
+               <div id="wrapper">
+                       {{- partial "header.html" . -}}
+
+                       <section id="banner" class="major">
+                               <div class="inner">
+                                       <header class="major">
+                                               <h1>{{ .Site.Title }}</h1>
+                                       </header>
+                                       <div class="content">
+                                               <p>{{ .Site.Params.Description }}</p>
+                                       </div>
+                               </div>
+                       </section>
+
+                       <div id="main">
+                               {{- block "category-list" . }}{{- end }}
+                       </div>
+                       {{- partial "footer.html" . -}}
+               </div>
+               {{- partial "footer-addition.html" . -}}
+       </body>
+</html>
+
diff --git a/layouts/categories/list.html b/layouts/categories/list.html
new file mode 100644 (file)
index 0000000..dbc5c92
--- /dev/null
@@ -0,0 +1,51 @@
+{{ define "category-list" }}
+<section id="one">
+       <div class="inner">
+               <header class="major">
+                       <h2>Category: {{ .Title }}</h2>
+               </header>
+               <p>Here you'll find all my articles related to {{ .Title }}. Enjoy.</p>
+       </div>
+</section>
+<section id="two" class="spotlights">
+       <!-- Ranges through content/articles/*.md -->
+       {{ range .Paginator.Pages }}
+       <section>
+               <a class="image" href="{{.Permalink}}">
+               {{ if isset .Params "featured_image" }}
+                       <img src="{{ .Params.featured_image | absURL}}" data-position="center center" alt="{{.Title}}">
+               {{ else }}
+                       {{ $default_image := resources.Get "img/default_article.jpg" }} 
+                       <img src="{{ $default_image.Permalink }}" data-position="center center" alt="{{.Title}}">
+               {{ end }}
+               </a>
+               <div class="content">
+                       <div class="inner">
+                               <header class="major">
+                                       <h3>
+                                       {{ if gt (len .Title) 40 }}
+                                               {{ $first50 := ( substr .Title 0 40 ) }}
+                                               {{ $lastChars := ( substr .Title 40 ) }}
+                                               {{ $newLine := "<br>" }}
+                                               {{ $newTitle := ( printf "%s" $lastChars | printf "%s%s" $newLine | printf "%s%s" $first50  ) }}
+                                               {{ $newTitle | safeHTML }}
+                                       {{ else }}
+                                               {{ .Title }}
+                                       {{ end }}
+                                       </h3>
+                               </header>
+                               <p>{{ .Params.excerpt }}</p>
+                               <ul class="actions">
+                                       <li><a href="{{.Permalink}}" class="button">Read More</a></li>
+                               </ul>
+                       </div>
+               </div>
+       </section>
+       {{ end }}
+</section>
+<section id="three">
+       <div class="inner">
+               {{ partial "pagination.html" . }}
+       </div>
+</section>
+{{ end }}
index 5d3a050..8f9a800 100644 (file)
@@ -5,7 +5,7 @@
                <a id="top" class="scrolly skip-link screen-reader-text" href="#main">skip to content</a>
                <div id="wrapper">
                        {{- partial "header.html" . -}}
-                       <section id="banner" class="major">
+                       <section id="banner" class="major{{if .IsHome }} style4{{ end }}">
                                <div class="inner">
                                        <header class="major">
                                                <h1>{{ .Site.Title }}</h1>
index ba45dee..f8ed8bd 100644 (file)
@@ -5,7 +5,7 @@
                                <ul class="footer-tools">
                                        <li><a href="/danix_pubkey.asc" title="My public GPG key" target="_blank">{{- partial "funcs/svg.html" (dict "context" . "username" "key") -}}<span class="screen-reader-text">My GnuPG public key</span></a></li>
                                        <li><a href="{{.Site.BaseURL}}sitemap.xml" target="_blank">{{- partial "funcs/svg.html" (dict "context" . "username" "sitemap") -}}<span class="screen-reader-text">sitemap</span></a></li>
-                                       <li><a href="{{ ref . "legal" }}">{{- partial "funcs/svg.html" (dict "context" . "username" "lock-open") -}}<span class="screen-reader-text">Privacy Policy</span></a></li>
+                                       <li><a href="{{ ref . "is/legal/index.md" }}">{{- partial "funcs/svg.html" (dict "context" . "username" "lock-open") -}}<span class="screen-reader-text">Privacy Policy</span></a></li>
                                </ul>
                        </div>
                        <div class="col-4 col-12-medium copyright align-center">
index 55ec660..06ddf47 100644 (file)
@@ -1,4 +1,4 @@
-<header id="header" class="alt">
+<header id="header" class="alt{{if .IsHome }} style4 reveal{{ end }}">
        <a href="{{ .Site.BaseURL }}" rel="home" class="logo"><strong>{{ slicestr .Site.Title 0 5 }}</strong><span>{{ slicestr .Site.Title 5 }}</span></a>
        <nav>
                <a href="#menu">Menu</a>