Browse Source

feat(feature/featured-posts): allow featured items in posts section

gives ability to display and customize featured posts and related content with thumbnails

BREAKING CHANGE: Hugo minimum required version now 0.51 (was 0.44)

close #170, close #160
pull/198/head
Josh Habdas 1 year ago
parent
commit
49f5c56767
Signed by: jhabdas GPG Key ID: B148B31154C75A74
26 changed files with 366 additions and 141 deletions
  1. +2
    -2
      README.md
  2. +0
    -44
      assets/css/conditional/layout/home.css
  3. +0
    -16
      assets/css/conditional/layout/post/single.css
  4. +0
    -25
      assets/css/conditional/layout/search.css
  5. +46
    -0
      assets/css/conditional/layouts/partials/page-thumbs.css
  6. +35
    -0
      assets/css/conditional/layouts/post/single.css
  7. +25
    -0
      assets/css/conditional/layouts/search.css
  8. +3
    -3
      bin/install
  9. +1
    -1
      docs/config/_default/config.toml
  10. +4
    -1
      docs/content/extra/high-tea.md
  11. +62
    -0
      docs/content/feature/featured-posts.md
  12. +1
    -1
      docs/content/feature/quick-install.id.md
  13. +1
    -1
      docs/content/feature/quick-install.md
  14. +8
    -4
      docs/content/feature/related-content.id.md
  15. +28
    -3
      docs/content/feature/related-content.md
  16. +7
    -1
      docs/content/feature/structured-data.id.md
  17. +2
    -2
      docs/content/feature/structured-data.md
  18. +1
    -1
      docs/layouts/index.html
  19. BIN
      docs/static/images/screenshots/feature-featured-posts-fs8.png
  20. BIN
      docs/static/images/screenshots/feature-related-content-fs8.png
  21. +6
    -23
      layouts/_default/home.html
  22. +1
    -1
      layouts/_default/search.html
  23. +43
    -0
      layouts/partials/page-thumbs.html
  24. +23
    -11
      layouts/partials/post/related-content.html
  25. +66
    -0
      layouts/post/list.html
  26. +1
    -1
      layouts/post/single.html

+ 2
- 2
README.md View File

@ -10,7 +10,7 @@
[![Latest NPM version](https://img.shields.io/npm/v/after-dark.svg?style=flat-square)](https://www.npmjs.com/package/after-dark)
[![Monthly downloads](https://img.shields.io/npm/dm/after-dark.svg?style=flat-square)](https://www.npmjs.com/package/after-dark)
[![Minimum Hugo version](https://img.shields.io/badge/hugo->%3D%200.44-FF4088.svg?style=flat-square)](https://gohugo.io)
[![Minimum Hugo version](https://img.shields.io/badge/hugo->%3D%200.51-FF4088.svg?style=flat-square)](https://gohugo.io)
[![IRC chat](https://img.shields.io/badge/irc-%23after--dark-32AFED.svg?style=flat-square&longCache=true)](https://after-dark.habd.as/#chat)
[![AGPL licensed](https://img.shields.io/npm/l/after-dark.svg?style=flat-square&longCache=true)](https://git.habd.as/comfusion/after-dark/src/branch/master/COPYING)
@ -47,7 +47,7 @@ Visit the [official docs](https://after-dark.habd.as) for demo and documentation
## Getting Started
[Install Hugo](https://gohugo.io/getting-started/installing) `0.44` or greater on your machine before getting started or unless you're creating an [Extended Build](https://after-dark.habd.as/#feature-builds) or starting with [After Dark K3s](https://after-dark.habd.as/extra/after-dark-k3s).
[Install Hugo](https://gohugo.io/getting-started/installing) `0.51` or greater on your machine before getting started unless starting with [After Dark K3s](https://after-dark.habd.as/extra/after-dark-k3s) or creating an [Extended Build](https://after-dark.habd.as/#feature-builds).
### Installation

+ 0
- 44
assets/css/conditional/layout/home.css View File

@ -1,44 +0,0 @@
/*!
* Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
*
* This file is part of After Dark.
*
* After Dark is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* After Dark is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
section ul.grid {
margin: 10px -10px;
}
section ul.grid li {
padding: 10px;
margin-bottom: 10px;
}
section ul.grid li h2 {
margin-bottom: 1rem;
}
section ul.grid li a figure:hover {
filter: brightness(1.1);
}
.hack section ul.grid li h2::before {
content: initial;
}
.hack section ul.grid li::after {
content: initial;
}
.standard section ol.grid,
.standard section ul.grid {
padding-left: 0px;
list-style-type: none;
display: flex;
}

+ 0
- 16
assets/css/conditional/layout/post/single.css View File

@ -1,16 +0,0 @@
.hack header figure[itemtype*="ImageObject"] {
position: relative;
}
.hack header figure[itemtype*="ImageObject"] figcaption {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
padding: 15px;
font-style: oblique;
font-size: smaller;
mix-blend-mode: soft-light;
}
.hack header figure[itemtype*="ImageObject"] [itemprop="headline"] {
font-weight: bold;
}

+ 0
- 25
assets/css/conditional/layout/search.css View File

@ -1,25 +0,0 @@
/*!
* Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
*
* This file is part of After Dark.
*
* After Dark is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* After Dark is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
[v-cloak] .js-cloaked {
display: none;
}
[v-cloak] .js-initializing::after {
content: "Initializing search. Please wait..."
}

+ 46
- 0
assets/css/conditional/layouts/partials/page-thumbs.css View File

@ -0,0 +1,46 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
ul.thumbnail.grid {
margin: 10px -10px;
}
ul.thumbnail.grid li {
padding: 10px;
margin-bottom: 10px;
}
ul.thumbnail.grid li h2 {
margin-bottom: 1rem;
}
ul.thumbnail.grid li a:hover figure {
filter: brightness(1.1);
}
ul.thumbnail.grid li a figure > img {
border-radius: 2px;
}
.hack ul.thumbnail.grid li h2::before {
content: initial;
}
.hack ul.thumbnail.grid li::after {
content: initial;
}
.standard ul.thumbnail.grid {
padding-left: 0px;
list-style-type: none;
display: flex;
}

+ 35
- 0
assets/css/conditional/layouts/post/single.css View File

@ -0,0 +1,35 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
.hack header figure[itemtype*="ImageObject"] {
position: relative;
}
.hack header figure[itemtype*="ImageObject"] figcaption {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
padding: 15px;
font-style: oblique;
font-size: smaller;
mix-blend-mode: soft-light;
}
.hack header figure[itemtype*="ImageObject"] [itemprop="headline"] {
font-weight: bold;
}

+ 25
- 0
assets/css/conditional/layouts/search.css View File

@ -0,0 +1,25 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
[v-cloak] .js-cloaked {
display: none;
}
[v-cloak] .js-initializing::after {
content: "Initializing search. Please wait..."
}

+ 3
- 3
bin/install View File

@ -22,13 +22,13 @@
validate_hugo () {
# Exit with error if hugo is not installed
if ! hash hugo 2>/dev/null ; then
echo "Error: After Dark requires Hugo version 0.44 or greater" >&2; exit 1
echo "Error: After Dark requires Hugo version 0.51 or greater" >&2; exit 1
fi
# Exit with error if not minimum required hugo version
re="v(0\d*\.([4-9][4-9]|[5-9])|[1-9]).*"
re="v(0\d*\.([5-9][1-9]|[6-9])|[1-9]).*"
if ! hugo version | grep -qE "$re" ; then
echo "Error: After Dark requires Hugo version 0.44 or greater" >&2; exit 1
echo "Error: After Dark requires Hugo version 0.51 or greater" >&2; exit 1
fi
}

+ 1
- 1
docs/config/_default/config.toml View File

@ -19,7 +19,7 @@
baseurl = "https://after-dark.habd.as/" # Controls base URL sitewide
title = "After Dark" # Homepage title and page title suffix
paginate = 38 # Number of items to show before paginating
paginate = 39 # Number of items to show before paginating
copyright = "Copyright &copy; Josh Habdas. Licensed under <a target=\"_blank\" rel=\"external noopener license\" href=\"https://www.gnu.org/licenses/agpl.html\">AGPL-3.0-or-later</a>."
# Controls default theme and theme components

+ 4
- 1
docs/content/extra/high-tea.md View File

@ -23,4 +23,7 @@ Use it to manage organizations, create pull mirrors, selectively mark private re
High Tea also provides a Traefik integration so you can manage web services, monitor traffic and inspect service health in real-time.
**Repository:** {{< external "https://git.habd.as/comfusion/high-tea" />}}
---
- {{< external "https://git.habd.as/comfusion/high-tea" />}} -- source
- {{< external "https://after-dark.habd.as/extra/high-tea/" />}} -- website

+ 62
- 0
docs/content/feature/featured-posts.md View File

@ -0,0 +1,62 @@
+++
title = "Featured Posts"
description = "Display your favorite blog posts front-and-center."
categories = ["navigation"]
tags = ["seo", "retention", "layout", "templating", "style"]
features = ["code highlighter", "snippets", "related content"]
[[copyright]]
owner = "Josh Habdas"
date = "2019"
license = "agpl-3.0-or-later"
+++
After Dark helps you showcase your favorite blog posts by allowing you to easily specify a set of pages to appear first in post listings using only site config.
{{< hackcss-alert >}}
{{< figure
src="/images/screenshots/feature-featured-posts-fs8.png"
>}}
{{< /hackcss-alert >}}
Use featured posts to drive more traffic to your highest value pages, increase the visibility of niche content or target pages for additional inbound links.
Adjust featured posts from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding:
```toml
[params.layout.post.featured]
limit = 3
items = [
"borg-backup-minio-scaleway",
"dual-boot-manjaro-mojave-macbook-pro",
"surfing-uncensorable-web",
"encrypted-internet-wireguard-manjaro-linux"
]
```
Modify `items` using the {{< external "https://gohugo.io/content-management/organization#slug" "page slugs" />}} from your posts and adjust the featured `limit` to the total number of items you wish to display. Like [Custom Homepage](../custom-homepage/) and [Related Content](../related-content/) performance-optimized thumbnail images will appear automatically when a post contains a [Post Image](../post-images/) with `thumbnail` in the name.
Optionally, customize thumbnail styling using [Custom Styles](../custom-styles/):
```css
ul.thumbnail.grid li a:hover figure {
filter: initial;
}
ul.thumbnail.grid li a figure {
position: relative;
line-height: 0;
margin-bottom: 8px;
}
ul.thumbnail.grid li a:hover figure::after {
content: "";
position: absolute;
bottom: 0;
display: block;
width: 100%;
height: 100%;
background: radial-gradient(
circle,
rgba(0,0,0,0.1) 0,
rgba(0,0,0,0.3) 100%
);
}
```

+ 1
- 1
docs/content/feature/quick-install.id.md View File

@ -14,7 +14,7 @@ notes = [
license = "agpl-3.0-or-later"
+++
After Dark termasuk skrip instalasi portabel untuk pengaturan cepat. Silahkan instal {{< external href="https://gohugo.io" text="Hugo" />}} `0.44` atau yang lebih besar sebelum menjalankan skrip:
After Dark termasuk skrip instalasi portabel untuk pengaturan cepat. Silahkan instal {{< external href="https://gohugo.io" text="Hugo" />}} `0.51` atau yang lebih besar sebelum menjalankan skrip:
{{< hackcss-alert >}}
<details itemscope itemtype="https://schema.org/SoftwareSourceCode">

+ 1
- 1
docs/content/feature/quick-install.md View File

@ -17,7 +17,7 @@ aliases = [
license = "agpl-3.0-or-later"
+++
After Dark includes a portable installation script for quick set-up. Please install {{< external href="https://gohugo.io" text="Hugo" />}} `0.44` or greater before running:
After Dark includes a portable installation script for quick set-up. Please install {{< external href="https://gohugo.io" text="Hugo" />}} `0.51` or greater before running:
{{< hackcss-alert >}}
<details itemscope itemtype="https://schema.org/SoftwareSourceCode">

+ 8
- 4
docs/content/feature/related-content.id.md View File

@ -2,7 +2,7 @@
title = "Related Content"
description = "Mempromosikan lebih banyak konten anda kepada pengunjung situs."
categories = ["navigation"]
tags = ["links", "retention", "engagement"]
tags = ["links", "retention", "engagement", "layout", "templating", "style"]
feature = ["code highlighter", "snippets", "related content"]
[[copyright]]
owner = "Josh Habdas"
@ -12,17 +12,21 @@ feature = ["code highlighter", "snippets", "related content"]
After Dark menyediakan konten terkait untuk membantu pengguna menemukan lebih banyak informasi yang relevan bagi mereka dan dapat meningkatkan tampilan halaman dan waktu yang dihabiskan untuk situs anda.
{{< hackcss-alert >}}
{{< figure
src="/images/screenshots/feature-related-content-fs8.png"
>}}
{{< /hackcss-alert >}}
Ketika dua halaman atau lebih atau postingan yang berisi taksonomi`tags` yang sama, mereka akan ditautkan di bagian seperti yang ditunjukkan di bagian bawah halaman. Bagian ini muncul secara otomatis seperti dibawah ini [Post Bylines](../post-bylines) dengan maksimum 7 item default yang ditampilkan.
{{% hackcss-alert type="info" %}}**Tip:** Buatlah [Custom Layout](/feature/custom-layouts) untuk menampilkan konten terkait diluar postingan.{{% /hackcss-alert %}}
Sesuaikan maksimum dari {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} dengan menambah `related_content_limit`:
Sesuaikan seluruh situs maksimum dari {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} dengan menambah `related_content_limit`:
```toml
[params]
related_content_limit = 5 # limit to 5 items maximum site-wide
```
Hapus pengaturan untuk kembali ke bentuk standar.
Lihat {{< external href="https://gohugo.io/content-management/related/" text="Related Content in Hugo" />}} untuk pilihan konfigurasi tambahan .

+ 28
- 3
docs/content/feature/related-content.md View File

@ -2,7 +2,7 @@
title = "Related Content"
description = "Promote more of your content to your site's visitors."
categories = ["navigation"]
tags = ["links", "retention", "engagement"]
tags = ["links", "retention", "engagement", "layout", "templating", "style"]
features = ["code highlighter", "snippets", "related content"]
[[copyright]]
owner = "Josh Habdas"
@ -12,17 +12,42 @@ features = ["code highlighter", "snippets", "related content"]
After Dark provides related content to help users find more information that's relevant to them and can increase page views and time spent on your site.
{{< hackcss-alert >}}
{{< figure
src="/images/screenshots/feature-related-content-fs8.png"
>}}
{{< /hackcss-alert >}}
When two or more pages or posts contain the same taxonomy `tags` they will be linked in a section as shown near the bottom of the page. The section appears automatically below [Post Bylines](../post-bylines) with a default maximum of 7 items shown.
{{% hackcss-alert type="info" %}}**Tip:** Create a [Custom Layout](/feature/custom-layouts) to show Related Content outside posts.{{% /hackcss-alert %}}
Adjust the maximum from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding `related_content_limit`:
Adjust site-wide maximum from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding `related_content_limit`:
```toml
[params]
related_content_limit = 5 # limit to 5 items maximum site-wide
```
Remove the setting to return to the default.
By default related content will appear as an unordered list of page titles with hyperlinks to their respective pages along with the approximate reading time.
For posts, display thumbnail images instead by adding a related limit:
```toml
[params.layout.post.related]
limit = 3
```
And for each post create a [Post Images](../post-images/)-formatted resource bundle containing `thumbnail` in the name as described in more detail on [Custom Homepage](../custom-homepage/).
As with homepage thumbnails, image processing may be adjusted:
```toml
[params.layout.post.related]
limit = 4
thumbs = ["fill", "400x400"] # Optional, thumbnail image processing
```
Set `limit` to `0` to hide the related content section.
See {{< external href="https://gohugo.io/content-management/related/" text="Related Content in Hugo" />}} for additional configuration options.

+ 7
- 1
docs/content/feature/structured-data.id.md View File

@ -10,7 +10,7 @@ feature = ["related content"]
license = "agpl-3.0-or-later"
+++
After Dark menghasilkan metadata terstruktur menggunakan {{< external "https://schema.org" />}} spesifikasi untuk postingan blog, [Menu Bagian](../section-menu), [Hall of Mirrors](/module/hall-of-mirrors) galeri gambar dan mengadaptasi data secara otomatis menggunakan yang ditentukan penulis [Post Bylines](../post-bylines) seperti yang ditunjukkan disini:
After Dark menghasilkan metadata terstruktur menggunakan {{< external "https://schema.org" />}} spesifikasi untuk postingan blog, [Custom Homepage](../custom-homepage), [Related Content](../related-content/), [Featured Posts](../featured-posts), [Menu Bagian](../section-menu), [Hall of Mirrors](/module/hall-of-mirrors) galeri gambar dan mengadaptasi data secara otomatis menggunakan yang ditentukan penulis [Post Bylines](../post-bylines) seperti yang ditunjukkan disini:
Properti skema | Nilai frontmatter
--------------- | -----------------
@ -18,6 +18,12 @@ author? | `author`
datePublished | `publishdate` atau `date`
articleSection | `categories`
[Post Images]({{< relref "post-images" >}}) use {{< external "https://gohugo.io/content-management/page-resources/#page-resources-metadata" "Page Resources Metadata" />}} to add image captions:
Schema Property | Header Image Resource Metadata
--------------- | ----------------
caption? | `creator` [`sameas` domain] or `caption`
Pertimbangkan untuk menambahkan data terstruktur saat membuat [Custom Layouts](../custom-layouts) untuk meningkatkan semantik halaman dan SEO yang lebih baik.
Pelajari lebih lanjut tentang data terstruktur menggunakan sumber daya berikut:

+ 2
- 2
docs/content/feature/structured-data.md View File

@ -10,7 +10,7 @@ features = ["related content"]
license = "agpl-3.0-or-later"
+++
After Dark generates structured metadata using {{< external "https://schema.org" />}} specifications for [Custom Homepage](../custom-homepage), [Section Menu](../section-menu), [Image Galleries](/module/hall-of-mirrors) and adapts data automatically using author-defined [Post Bylines](../post-bylines) as shown here:
After Dark generates structured metadata using {{< external "https://schema.org" />}} specifications for [Custom Homepage](../custom-homepage), [Related Content](../related-content/), [Featured Posts](../featured-posts), [Section Menu](../section-menu), [Image Galleries](/module/hall-of-mirrors) and adapts data automatically using author-defined [Post Bylines](../post-bylines) as shown here:
Schema Property | Frontmatter Value
--------------- | -----------------
@ -33,4 +33,4 @@ Learn more about structured data using the following resources:
- {{< external href="https://moz.com/learn/seo/schema-structured-data" text="Schema Structured Data on Moz" />}}
Use [Webmaster Tools](../webmaster-tools/) to validate structured data. This can be done from a development machine using [ephemeral hosting](../ephemeral-hosting/).
Use [Webmaster Tools](../webmaster-tools/) to validate structured data. This can be done from a development machine using [Ephemeral Hosting](../ephemeral-hosting/).

+ 1
- 1
docs/layouts/index.html View File

@ -69,7 +69,7 @@ along with this program. If not, see .
<th scope="col" width="25%">Extras</th>
</tr>
<tr>
<td><a href="./feature/">38</a></td>
<td><a href="./feature/">39</a></td>
<td><a href="./module/">4</a></td>
<td><a href="./shortcode/">27+</a></td>
<td><a href="./extra/">2</a></td>

BIN
docs/static/images/screenshots/feature-featured-posts-fs8.png View File

Before After
Width: 1754  |  Height: 956  |  Size: 320 KiB

BIN
docs/static/images/screenshots/feature-related-content-fs8.png View File

Before After
Width: 1666  |  Height: 804  |  Size: 249 KiB

+ 6
- 23
layouts/_default/home.html View File

@ -24,15 +24,15 @@ along with this program. If not, see .
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
{{ if ne .Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layout/home.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
<header>
<h1 itemprop="name">{{ .Title }}</h1>
</header>
{{ with .Site.Params.layout.home.section }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
{{ range sort . "weight" "asc" }}
<section>
{{ $index := site.GetPage "section" .type }}
@ -47,24 +47,7 @@ along with this program. If not, see .
</h1>
<blockquote itemprop="description">{{ $index.Description }}</blockquote>
</header>
<ul class="grid" itemscope itemtype="https://schema.org/ItemList">
<meta itemprop="itemListOrder" content="Unordered">
<meta itemprop="name" content="{{ $index.Title }}">
<meta itemprop="numberOfItems" content="{{ (default $page_count .limit) }}">
{{ $thumbnail_options := .thumbs }}
{{ range first (default $page_count .limit) $pages }}
{{ $page_schema := .Params.schema }}
{{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
{{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
<li class="cell" itemprop="itemListElement" itemscope itemtype="https://schema.org/{{ $schema_type }}">
<a itemprop="url" href="{{ .RelPermalink }}">
{{ partial "image/thumbnail.html" (dict "node" . "options" $thumbnail_options) }}
<h2 itemprop="name">{{ .Title }}</h2>
</a>
<small itemprop="description">{{ .Description }}</small>
</li>
{{ end }}
</ul>
{{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" .limit "pages" $pages) }}
{{ end }}
{{ if and (lt .limit $page_count) (ne 1 $page_count) }}
<nav class="readmore">

+ 1
- 1
layouts/_default/search.html View File

@ -28,7 +28,7 @@ along with this program. If not, see .
<h1>{{ .Title }}</h1>
</header>
<div id="search-app" v-cloak>
{{ with resources.Get "css/conditional/layout/search.css" | minify }}
{{ with resources.Get "css/conditional/layouts/search.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
<section>

+ 43
- 0
layouts/partials/page-thumbs.html View File

@ -0,0 +1,43 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
<ul class="thumbnail grid" itemscope itemtype="https://schema.org/ItemList">
<meta itemprop="itemListOrder" content="Unordered">
<meta itemprop="name" content="{{ .index.Title }}">
<meta itemprop="numberOfItems" content="{{ (default .page_count .limit) }}">
{{ $thumbnail_options := .thumbnail_options }}
{{ $show_readingtime := .show_readingtime }}
{{ range first (default .page_count .limit) .pages }}
{{ $page_schema := .Params.schema }}
{{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
{{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
<li class="cell" itemprop="itemListElement" itemscope itemtype="https://schema.org/{{ $schema_type }}">
<a itemprop="url" href="{{ .RelPermalink }}">
{{ partial "image/thumbnail.html" (dict "node" . "options" $thumbnail_options) }}
<h2 itemprop="name">{{ .Title }}</h2>
</a>
<small itemprop="description">
{{ .Description }}
{{ if $show_readingtime }}
<time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
{{ end }}
</small>
</li>
{{ end }}
</ul>

+ 23
- 11
layouts/partials/post/related-content.html View File

@ -17,16 +17,28 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ -}}
{{ $num_to_show := .Site.Params.related_content_limit | default 7 }}
{{ $related := .Site.RegularPages.Related . | first $num_to_show }}
{{ with $related }}
<aside>
<header>Related Content</header>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
<time datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
{{ $limit := (index .Site.Params.layout .Type).related.limit | default .Site.Params.related_content_limit }}
{{ $pages := .Site.RegularPages.Related . | first (default 7 $limit) }}
{{ $page_count := len $pages }}
{{ if and (gt $page_count 1) (ne $limit 0) }}
{{ with $pages }}
<aside>
<header>Related Content</header>
{{ with (index $.Site.Params.layout $.Type).related }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
{{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" $limit "pages" $pages "show_readingtime" true) }}
{{ else }}
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
<time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
{{ end }}
</ul>
{{ end }}
</ul>
</aside>
</aside>
{{ end }}
{{ end }}

+ 66
- 0
layouts/post/list.html View File

@ -0,0 +1,66 @@
{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/}}
{{ define "header" }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<header>
<h1 itemprop="name">{{ .Title }}</h1>
</header>
{{ $scratch := newScratch }}
{{ with (index .Site.Params.layout .Type).featured }}
{{ $scratch.Add "featured" slice }}
{{ range first .limit .items }}
{{ $scratch.Add "featured" (site.GetPage .) }}
{{ end }}
{{ if ge (len ($scratch.Get "featured")) 1 }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}
<section>
{{ $index := site.GetPage "section" $.Type }}
{{ $pages := $scratch.Get "featured" }}
{{ $page_count := default 1 (len $pages) }}
{{ if eq $page_count 1 }}
{{ partial "page-summary.html" $index }}
{{ else if gt $page_count 1 }}
<header>
<h1 itemprop="name">
<a href="{{ $index.RelPermalink }}">Featured {{ $index.Title }}</a>
</h1>
<blockquote itemprop="description">{{ $index.Description }}</blockquote>
</header>
{{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" .limit "pages" $pages) }}
{{ end }}
</section>
{{ end }}
{{ end }}
{{ range (.Paginate (collections.SymDiff .Pages ($scratch.Get "featured"))).Pages }}
{{ partial "page-summary.html" . }}
{{ end }}
{{ end }}
{{ define "footer" }}
<p>{{ partial "pagination.html" . }}</p>
<small class="muted">
{{ partial "copyright-notice.html" . }}
</small>
{{ end }}

+ 1
- 1
layouts/post/single.html View File

@ -22,7 +22,7 @@ along with this program. If not, see .
{{ end }}
{{ define "main" }}
{{ if ne $.Site.Params.hackcss.disabled true }}
{{ with resources.Get "css/conditional/layout/post/single.css" | minify }}
{{ with resources.Get "css/conditional/layouts/post/single.css" | minify }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
{{ end }}

Loading…
Cancel
Save