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
Josh Habdas 2 months ago
parent
commit
49f5c56767
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74

+ 2
- 2
README.md View File

@@ -10,7 +10,7 @@
10 10
 
11 11
 [![Latest NPM version](https://img.shields.io/npm/v/after-dark.svg?style=flat-square)](https://www.npmjs.com/package/after-dark)
12 12
 [![Monthly downloads](https://img.shields.io/npm/dm/after-dark.svg?style=flat-square)](https://www.npmjs.com/package/after-dark)
13
-[![Minimum Hugo version](https://img.shields.io/badge/hugo->%3D%200.44-FF4088.svg?style=flat-square)](https://gohugo.io)
13
+[![Minimum Hugo version](https://img.shields.io/badge/hugo->%3D%200.51-FF4088.svg?style=flat-square)](https://gohugo.io)
14 14
 [![IRC chat](https://img.shields.io/badge/irc-%23after--dark-32AFED.svg?style=flat-square&longCache=true)](https://after-dark.habd.as/#chat)
15 15
 [![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)
16 16
 
@@ -47,7 +47,7 @@ Visit the [official docs](https://after-dark.habd.as) for demo and documentation
47 47
 
48 48
 ## Getting Started
49 49
 
50
-[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).
50
+[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).
51 51
 
52 52
 ### Installation
53 53
 

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

@@ -1,44 +0,0 @@
1
-/*!
2
- * Copyright (C) 2019  Josh Habdas <jhabdas@protonmail.com>
3
- *
4
- * This file is part of After Dark.
5
- *
6
- * After Dark is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Affero General Public License as published
8
- * by the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * After Dark is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU Affero General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Affero General Public License
17
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
- */
19
-
20
-section ul.grid {
21
-  margin: 10px -10px;
22
-}
23
-section ul.grid li {
24
-  padding: 10px;
25
-  margin-bottom: 10px;
26
-}
27
-section ul.grid li h2 {
28
-  margin-bottom: 1rem;
29
-}
30
-section ul.grid li a figure:hover {
31
-  filter: brightness(1.1);
32
-}
33
-.hack section ul.grid li h2::before {
34
-  content: initial;
35
-}
36
-.hack section ul.grid li::after {
37
-  content: initial;
38
-}
39
-.standard section ol.grid,
40
-.standard section ul.grid {
41
-  padding-left: 0px;
42
-  list-style-type: none;
43
-  display: flex;
44
-}

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

@@ -1,16 +0,0 @@
1
-.hack header figure[itemtype*="ImageObject"] {
2
-  position: relative;
3
-}
4
-.hack header figure[itemtype*="ImageObject"] figcaption {
5
-  position: absolute;
6
-  bottom: 0;
7
-  right: 0;
8
-  text-align: right;
9
-  padding: 15px;
10
-  font-style: oblique;
11
-  font-size: smaller;
12
-  mix-blend-mode: soft-light;
13
-}
14
-.hack header figure[itemtype*="ImageObject"] [itemprop="headline"] {
15
-  font-weight: bold;
16
-}

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

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

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

@@ -0,0 +1,46 @@
1
+{{/*
2
+Copyright (C) 2019  Josh Habdas <jhabdas@protonmail.com>
3
+
4
+This file is part of After Dark.
5
+
6
+After Dark is free software: you can redistribute it and/or modify
7
+it under the terms of the GNU Affero General Public License as published by
8
+the Free Software Foundation, either version 3 of the License, or
9
+(at your option) any later version.
10
+
11
+After Dark is distributed in the hope that it will be useful,
12
+but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+GNU Affero General Public License for more details.
15
+
16
+You should have received a copy of the GNU Affero General Public License
17
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+*/ -}}
19
+
20
+ul.thumbnail.grid {
21
+  margin: 10px -10px;
22
+}
23
+ul.thumbnail.grid li {
24
+  padding: 10px;
25
+  margin-bottom: 10px;
26
+}
27
+ul.thumbnail.grid li h2 {
28
+  margin-bottom: 1rem;
29
+}
30
+ul.thumbnail.grid li a:hover figure {
31
+  filter: brightness(1.1);
32
+}
33
+ul.thumbnail.grid li a figure > img {
34
+  border-radius: 2px;
35
+}
36
+.hack ul.thumbnail.grid li h2::before {
37
+  content: initial;
38
+}
39
+.hack ul.thumbnail.grid li::after {
40
+  content: initial;
41
+}
42
+.standard ul.thumbnail.grid {
43
+  padding-left: 0px;
44
+  list-style-type: none;
45
+  display: flex;
46
+}

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

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

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

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

+ 3
- 3
bin/install View File

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

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

@@ -19,7 +19,7 @@
19 19
 
20 20
 baseurl = "https://after-dark.habd.as/" # Controls base URL sitewide
21 21
 title = "After Dark" # Homepage title and page title suffix
22
-paginate = 38 # Number of items to show before paginating
22
+paginate = 39 # Number of items to show before paginating
23 23
 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>."
24 24
 
25 25
 # 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
23 23
 
24 24
 High Tea also provides a Traefik integration so you can manage web services, monitor traffic and inspect service health in real-time.
25 25
 
26
-**Repository:** {{< external "https://git.habd.as/comfusion/high-tea" />}}
26
+---
27
+
28
+- {{< external "https://git.habd.as/comfusion/high-tea" />}} -- source
29
+- {{< external "https://after-dark.habd.as/extra/high-tea/" />}} -- website

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

@@ -0,0 +1,62 @@
1
++++
2
+title = "Featured Posts"
3
+description = "Display your favorite blog posts front-and-center."
4
+categories = ["navigation"]
5
+tags = ["seo", "retention", "layout", "templating", "style"]
6
+features = ["code highlighter", "snippets", "related content"]
7
+[[copyright]]
8
+  owner = "Josh Habdas"
9
+  date = "2019"
10
+  license = "agpl-3.0-or-later"
11
++++
12
+
13
+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.
14
+
15
+{{< hackcss-alert >}}
16
+{{< figure
17
+  src="/images/screenshots/feature-featured-posts-fs8.png"
18
+>}}
19
+{{< /hackcss-alert >}}
20
+
21
+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.
22
+
23
+Adjust featured posts from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding:
24
+
25
+```toml
26
+[params.layout.post.featured]
27
+  limit = 3
28
+  items = [
29
+    "borg-backup-minio-scaleway",
30
+    "dual-boot-manjaro-mojave-macbook-pro",
31
+    "surfing-uncensorable-web",
32
+    "encrypted-internet-wireguard-manjaro-linux"
33
+  ]
34
+```
35
+
36
+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.
37
+
38
+Optionally, customize thumbnail styling using [Custom Styles](../custom-styles/):
39
+
40
+```css
41
+ul.thumbnail.grid li a:hover figure {
42
+  filter: initial;
43
+}
44
+ul.thumbnail.grid li a figure {
45
+  position: relative;
46
+  line-height: 0;
47
+  margin-bottom: 8px;
48
+}
49
+ul.thumbnail.grid li a:hover figure::after {
50
+  content: "";
51
+  position: absolute;
52
+  bottom: 0;
53
+  display: block;
54
+  width: 100%;
55
+  height: 100%;
56
+  background: radial-gradient(
57
+    circle,
58
+    rgba(0,0,0,0.1) 0,
59
+    rgba(0,0,0,0.3) 100%
60
+  );
61
+}
62
+```

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

@@ -14,7 +14,7 @@ notes = [
14 14
   license = "agpl-3.0-or-later"
15 15
 +++
16 16
 
17
-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:
17
+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:
18 18
 
19 19
 {{< hackcss-alert >}}
20 20
 <details itemscope itemtype="https://schema.org/SoftwareSourceCode">

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

@@ -17,7 +17,7 @@ aliases = [
17 17
   license = "agpl-3.0-or-later"
18 18
 +++
19 19
 
20
-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:
20
+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:
21 21
 
22 22
 {{< hackcss-alert >}}
23 23
 <details itemscope itemtype="https://schema.org/SoftwareSourceCode">

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

@@ -2,7 +2,7 @@
2 2
 title = "Related Content"
3 3
 description = "Mempromosikan lebih banyak konten anda kepada pengunjung situs."
4 4
 categories = ["navigation"]
5
-tags = ["links", "retention", "engagement"]
5
+tags = ["links", "retention", "engagement", "layout", "templating", "style"]
6 6
 feature = ["code highlighter", "snippets", "related content"]
7 7
 [[copyright]]
8 8
   owner = "Josh Habdas"
@@ -12,17 +12,21 @@ feature = ["code highlighter", "snippets", "related content"]
12 12
 
13 13
 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.
14 14
 
15
+{{< hackcss-alert >}}
16
+{{< figure
17
+  src="/images/screenshots/feature-related-content-fs8.png"
18
+>}}
19
+{{< /hackcss-alert >}}
20
+
15 21
 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.
16 22
 
17 23
 {{% hackcss-alert type="info" %}}**Tip:** Buatlah [Custom Layout](/feature/custom-layouts) untuk menampilkan konten terkait diluar postingan.{{% /hackcss-alert %}}
18 24
 
19
-Sesuaikan maksimum dari {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} dengan menambah `related_content_limit`:
25
+Sesuaikan seluruh situs maksimum dari {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} dengan menambah `related_content_limit`:
20 26
 
21 27
 ```toml
22 28
 [params]
23 29
   related_content_limit = 5 # limit to 5 items maximum site-wide
24 30
 ```
25 31
 
26
-Hapus pengaturan untuk kembali ke bentuk standar.
27
-
28 32
 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 @@
2 2
 title = "Related Content"
3 3
 description = "Promote more of your content to your site's visitors."
4 4
 categories = ["navigation"]
5
-tags = ["links", "retention", "engagement"]
5
+tags = ["links", "retention", "engagement", "layout", "templating", "style"]
6 6
 features = ["code highlighter", "snippets", "related content"]
7 7
 [[copyright]]
8 8
   owner = "Josh Habdas"
@@ -12,17 +12,42 @@ features = ["code highlighter", "snippets", "related content"]
12 12
 
13 13
 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.
14 14
 
15
+{{< hackcss-alert >}}
16
+{{< figure
17
+  src="/images/screenshots/feature-related-content-fs8.png"
18
+>}}
19
+{{< /hackcss-alert >}}
20
+
15 21
 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.
16 22
 
17 23
 {{% hackcss-alert type="info" %}}**Tip:** Create a [Custom Layout](/feature/custom-layouts) to show Related Content outside posts.{{% /hackcss-alert %}}
18 24
 
19
-Adjust the maximum from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding `related_content_limit`:
25
+Adjust site-wide maximum from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding `related_content_limit`:
20 26
 
21 27
 ```toml
22 28
 [params]
23 29
   related_content_limit = 5 # limit to 5 items maximum site-wide
24 30
 ```
25 31
 
26
-Remove the setting to return to the default.
32
+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.
33
+
34
+For posts, display thumbnail images instead by adding a related limit:
35
+
36
+```toml
37
+[params.layout.post.related]
38
+  limit = 3
39
+```
40
+
41
+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/).
42
+
43
+As with homepage thumbnails, image processing may be adjusted:
44
+
45
+```toml
46
+[params.layout.post.related]
47
+  limit = 4
48
+  thumbs = ["fill", "400x400"] # Optional, thumbnail image processing
49
+```
50
+
51
+Set `limit` to `0` to hide the related content section.
27 52
 
28 53
 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"]
10 10
   license = "agpl-3.0-or-later"
11 11
 +++
12 12
 
13
-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:
13
+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:
14 14
 
15 15
 Properti skema | Nilai frontmatter
16 16
 --------------- | -----------------
@@ -18,6 +18,12 @@ author?         | `author`
18 18
 datePublished   | `publishdate` atau `date`
19 19
 articleSection  | `categories`
20 20
 
21
+[Post Images]({{< relref "post-images" >}}) use {{< external "https://gohugo.io/content-management/page-resources/#page-resources-metadata" "Page Resources Metadata" />}} to add image captions:
22
+
23
+Schema Property | Header Image Resource Metadata
24
+--------------- | ----------------
25
+caption?        | `creator` [`sameas` domain] or `caption`
26
+
21 27
 Pertimbangkan untuk menambahkan data terstruktur saat membuat [Custom Layouts](../custom-layouts) untuk meningkatkan semantik halaman dan SEO yang lebih baik.
22 28
 
23 29
 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"]
10 10
   license = "agpl-3.0-or-later"
11 11
 +++
12 12
 
13
-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:
13
+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:
14 14
 
15 15
 Schema Property | Frontmatter Value
16 16
 --------------- | -----------------
@@ -33,4 +33,4 @@ Learn more about structured data using the following resources:
33 33
 - {{< external href="https://moz.com/learn/seo/schema-structured-data" text="Schema Structured Data on Moz" />}}
34 34
 
35 35
 
36
-Use [Webmaster Tools](../webmaster-tools/) to validate structured data. This can be done from a development machine using [ephemeral hosting](../ephemeral-hosting/).
36
+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 <https://www.gnu.org/licenses/>.
69 69
             <th scope="col" width="25%">Extras</th>
70 70
           </tr>
71 71
           <tr>
72
-            <td><a href="./feature/">38</a></td>
72
+            <td><a href="./feature/">39</a></td>
73 73
             <td><a href="./module/">4</a></td>
74 74
             <td><a href="./shortcode/">27+</a></td>
75 75
             <td><a href="./extra/">2</a></td>

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


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


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

@@ -24,15 +24,15 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
24 24
   {{ partial "masthead.html" . }}
25 25
 {{ end }}
26 26
 {{ define "main" }}
27
-  {{ if ne .Site.Params.hackcss.disabled true }}
28
-    {{ with resources.Get "css/conditional/layout/home.css" | minify }}
29
-      <style>{{ .Content | safeCSS }}</style>
30
-    {{ end }}
31
-  {{ end }}
32 27
   <header>
33 28
     <h1 itemprop="name">{{ .Title }}</h1>
34 29
   </header>
35 30
   {{ with .Site.Params.layout.home.section }}
31
+    {{ if ne $.Site.Params.hackcss.disabled true }}
32
+      {{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
33
+        <style>{{ .Content | safeCSS }}</style>
34
+      {{ end }}
35
+    {{ end }}
36 36
     {{ range sort . "weight" "asc" }}
37 37
       <section>
38 38
         {{ $index := site.GetPage "section" .type }}
@@ -47,24 +47,7 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
47 47
             </h1>
48 48
             <blockquote itemprop="description">{{ $index.Description }}</blockquote>
49 49
           </header>
50
-          <ul class="grid" itemscope itemtype="https://schema.org/ItemList">
51
-            <meta itemprop="itemListOrder" content="Unordered">
52
-            <meta itemprop="name" content="{{ $index.Title }}">
53
-            <meta itemprop="numberOfItems" content="{{ (default $page_count .limit) }}">
54
-            {{ $thumbnail_options := .thumbs }}
55
-            {{ range first (default $page_count .limit) $pages }}
56
-              {{ $page_schema := .Params.schema }}
57
-              {{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
58
-              {{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
59
-              <li class="cell" itemprop="itemListElement" itemscope itemtype="https://schema.org/{{ $schema_type }}">
60
-                <a itemprop="url" href="{{ .RelPermalink }}">
61
-                  {{ partial "image/thumbnail.html" (dict "node" . "options" $thumbnail_options) }}
62
-                  <h2 itemprop="name">{{ .Title }}</h2>
63
-                </a>
64
-                <small itemprop="description">{{ .Description }}</small>
65
-              </li>
66
-            {{ end }}
67
-          </ul>
50
+          {{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" .limit "pages" $pages) }}
68 51
         {{ end }}
69 52
         {{ if and (lt .limit $page_count) (ne 1 $page_count) }}
70 53
           <nav class="readmore">

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

@@ -28,7 +28,7 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
28 28
     <h1>{{ .Title }}</h1>
29 29
   </header>
30 30
   <div id="search-app" v-cloak>
31
-    {{ with resources.Get "css/conditional/layout/search.css" | minify }}
31
+    {{ with resources.Get "css/conditional/layouts/search.css" | minify }}
32 32
       <style>{{ .Content | safeCSS }}</style>
33 33
     {{ end }}
34 34
     <section>

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

@@ -0,0 +1,43 @@
1
+{{/*
2
+Copyright (C) 2019  Josh Habdas <jhabdas@protonmail.com>
3
+
4
+This file is part of After Dark.
5
+
6
+After Dark is free software: you can redistribute it and/or modify
7
+it under the terms of the GNU Affero General Public License as published by
8
+the Free Software Foundation, either version 3 of the License, or
9
+(at your option) any later version.
10
+
11
+After Dark is distributed in the hope that it will be useful,
12
+but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+GNU Affero General Public License for more details.
15
+
16
+You should have received a copy of the GNU Affero General Public License
17
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+*/ -}}
19
+
20
+<ul class="thumbnail grid" itemscope itemtype="https://schema.org/ItemList">
21
+  <meta itemprop="itemListOrder" content="Unordered">
22
+  <meta itemprop="name" content="{{ .index.Title }}">
23
+  <meta itemprop="numberOfItems" content="{{ (default .page_count .limit) }}">
24
+  {{ $thumbnail_options := .thumbnail_options }}
25
+  {{ $show_readingtime := .show_readingtime }}
26
+  {{ range first (default .page_count .limit) .pages }}
27
+    {{ $page_schema := .Params.schema }}
28
+    {{ $section_schema := (.Site.GetPage "section" .Page.Type).Params.schema }}
29
+    {{ $schema_type := (default $section_schema.type $page_schema.type) | default "Thing" }}
30
+    <li class="cell" itemprop="itemListElement" itemscope itemtype="https://schema.org/{{ $schema_type }}">
31
+      <a itemprop="url" href="{{ .RelPermalink }}">
32
+        {{ partial "image/thumbnail.html" (dict "node" . "options" $thumbnail_options) }}
33
+        <h2 itemprop="name">{{ .Title }}</h2>
34
+      </a>
35
+      <small itemprop="description">
36
+        {{ .Description }}
37
+        {{ if $show_readingtime }}
38
+          <time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
39
+        {{ end }}
40
+      </small>
41
+    </li>
42
+  {{ end }}
43
+</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
17 17
 along with this program.  If not, see <https://www.gnu.org/licenses/>.
18 18
 */ -}}
19 19
 
20
-{{ $num_to_show := .Site.Params.related_content_limit | default 7 }}
21
-{{ $related := .Site.RegularPages.Related . | first $num_to_show }}
22
-{{ with $related }}
23
-  <aside>
24
-    <header>Related Content</header>
25
-    <ul>
26
-      {{ range . }}
27
-        <li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
28
-        <time datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
20
+{{ $limit := (index .Site.Params.layout .Type).related.limit | default .Site.Params.related_content_limit }}
21
+{{ $pages := .Site.RegularPages.Related . | first (default 7 $limit) }}
22
+{{ $page_count := len $pages }}
23
+{{ if and (gt $page_count 1) (ne $limit 0) }}
24
+  {{ with $pages }}
25
+    <aside>
26
+      <header>Related Content</header>
27
+      {{ with (index $.Site.Params.layout $.Type).related }}
28
+        {{ if ne $.Site.Params.hackcss.disabled true }}
29
+          {{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
30
+            <style>{{ .Content | safeCSS }}</style>
31
+          {{ end }}
32
+        {{ end }}
33
+        {{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" $limit "pages" $pages "show_readingtime" true) }}
34
+      {{ else }}
35
+        <ul>
36
+          {{ range . }}
37
+            <li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
38
+            <time class="muted" datetime="{{ .ReadingTime }}M">{{ .ReadingTime }} minutes</time>
39
+          {{ end }}
40
+        </ul>
29 41
       {{ end }}
30
-    </ul>
31
-  </aside>
42
+    </aside>
43
+  {{ end }}
32 44
 {{ end }}

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

@@ -0,0 +1,66 @@
1
+{{/*
2
+Copyright (C) 2019  Josh Habdas <jhabdas@protonmail.com>
3
+
4
+This file is part of After Dark.
5
+
6
+After Dark is free software: you can redistribute it and/or modify
7
+it under the terms of the GNU Affero General Public License as published by
8
+the Free Software Foundation, either version 3 of the License, or
9
+(at your option) any later version.
10
+
11
+After Dark is distributed in the hope that it will be useful,
12
+but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+GNU Affero General Public License for more details.
15
+
16
+You should have received a copy of the GNU Affero General Public License
17
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+*/}}
19
+
20
+{{ define "header" }}
21
+  {{ partial "masthead.html" . }}
22
+{{ end }}
23
+{{ define "main" }}
24
+  <header>
25
+    <h1 itemprop="name">{{ .Title }}</h1>
26
+  </header>
27
+  {{ $scratch := newScratch }}
28
+  {{ with (index .Site.Params.layout .Type).featured }}
29
+    {{ $scratch.Add "featured" slice }}
30
+    {{ range first .limit .items }}
31
+      {{ $scratch.Add "featured" (site.GetPage .) }}
32
+    {{ end }}
33
+    {{ if ge (len ($scratch.Get "featured")) 1 }}
34
+      {{ if ne $.Site.Params.hackcss.disabled true }}
35
+        {{ with resources.Get "css/conditional/layouts/partials/page-thumbs.css" | minify }}
36
+          <style>{{ .Content | safeCSS }}</style>
37
+        {{ end }}
38
+      {{ end }}
39
+      <section>
40
+        {{ $index := site.GetPage "section" $.Type }}
41
+        {{ $pages := $scratch.Get "featured" }}
42
+        {{ $page_count := default 1 (len $pages) }}
43
+        {{ if eq $page_count 1 }}
44
+          {{ partial "page-summary.html" $index }}
45
+        {{ else if gt $page_count 1 }}
46
+          <header>
47
+            <h1 itemprop="name">
48
+              <a href="{{ $index.RelPermalink }}">Featured {{ $index.Title }}</a>
49
+            </h1>
50
+            <blockquote itemprop="description">{{ $index.Description }}</blockquote>
51
+          </header>
52
+          {{ partial "page-thumbs.html" (dict "thumbnail_options" .thumbs "page_count" $page_count "limit" .limit "pages" $pages) }}
53
+        {{ end }}
54
+      </section>
55
+    {{ end }}
56
+  {{ end }}
57
+  {{ range (.Paginate (collections.SymDiff .Pages ($scratch.Get "featured"))).Pages }}
58
+    {{ partial "page-summary.html" . }}
59
+  {{ end }}
60
+{{ end }}
61
+{{ define "footer" }}
62
+  <p>{{ partial "pagination.html" . }}</p>
63
+  <small class="muted">
64
+    {{ partial "copyright-notice.html" . }}
65
+  </small>
66
+{{ end }}

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

@@ -22,7 +22,7 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
22 22
 {{ end }}
23 23
 {{ define "main" }}
24 24
   {{ if ne $.Site.Params.hackcss.disabled true }}
25
-    {{ with resources.Get "css/conditional/layout/post/single.css" | minify }}
25
+    {{ with resources.Get "css/conditional/layouts/post/single.css" | minify }}
26 26
       <style>{{ .Content | safeCSS }}</style>
27 27
     {{ end }}
28 28
   {{ end }}

Loading…
Cancel
Save