commit f5d38d8b0905b61ad608c2a16ca58bb8a7a70b87
parent baebb1abfee8bc185e7dfddc99428492644d4662
Author: Lou Woell <lou.woell@posteo.de>
Date: Mon, 11 Mar 2024 19:31:15 +0100
Better index Files
Allows to hide List of posts on index pages with the `NoPosts` option.
If a title is specified inserts it.
Diffstat:
4 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md
@@ -0,0 +1,7 @@
+---
+title: hahaha
+NoPosts: t
+---
+
+
+{{% framed %}} test {{% /framed %}}
diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md
@@ -1,22 +0,0 @@
-+++
-title = "About"
-date = "2019-01-25"
-author = "Radek"
-+++
-
-# Hi there
-
-My name is Radek and I'm the author of this theme. I made it to help you present your ideas easier.
-
-We all know how hard is to start something on the web, especially these days. You need to prepare a bunch of stuff, configure them and when that’s done — create the content.
-
-This theme is pretty basic and covers all of the essentials. All you have to do is start typing!
-
-The theme includes:
-
-- **5 duotone themes**, depending on your preferences (orange, red, blue, green, pink)
-- [**Fira Code**](https://github.com/tonsky/FiraCode) as default monospaced font. It's gorgeous!
-- **really nice, custom duotone** syntax highlighting based on [**PrismJS**](https://prismjs.com)
-- mobile friendly layout
-
-So, there you have it... enjoy!
diff --git a/exampleSite/content/about/_index.md b/exampleSite/content/about/_index.md
@@ -0,0 +1,27 @@
+---
+title: about
+date: "2019-01-25"
+author: "Radek"
+---
+
+# Hi there
+
+My name is Radek and I'm the author of this theme. I made it to help you present your ideas easier.
+
+We all know how hard is to start something on the web, especially these days. You need to prepare a bunch of stuff, configure them and when that’s done — create the content.
+
+This theme is pretty basic and covers all of the essentials. All you have to do is start typing!
+
+The theme includes:
+
+- **5 duotone themes**, depending on your preferences (orange, red, blue, green, pink)
+- [**Fira Code**](https://github.com/tonsky/FiraCode) as default monospaced font. It's gorgeous!
+- **really nice, custom duotone** syntax highlighting based on [**PrismJS**](https://prismjs.com)
+- mobile friendly layout
+
+So, there you have it... enjoy!
+
+{{%framed%}}
+This Version of the theme also includes the `framed` shortcode for easy framing
+of stuff.
+{{%/framed%}}
diff --git a/layouts/_default/index.html b/layouts/_default/index.html
@@ -1,9 +1,16 @@
{{ define "main" }}
+ {{ partial "cover.html" . }}
+ {{ if .Title }}
+ <h1 class="post-title">
+ <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
+ </h1>
+ {{ end }}
{{ if .Content }}
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
{{ .Content }}
</div>
{{ end }}
+ {{ if not .Params.NoPosts }}
<div class="posts">
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
@@ -13,7 +20,6 @@
{{ $PageContext = .Site }}
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
-
{{ range $paginator.Pages }}
<article class="post on-list">
<h1 class="post-title">
@@ -63,4 +69,5 @@
{{ partial "pagination.html" . }}
</div>
+ {{ end }}
{{ end }}