You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.1 KiB

4 years ago
  1. +++
  2. title = "Related Content"
  3. description = "Promote more of your content to your site's visitors."
  4. categories = ["navigation"]
  5. tags = ["links", "retention", "engagement", "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. 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.
  13. {{< hackcss-alert >}}
  14. {{< figure
  15. src="/images/screenshots/feature-related-content-fs8.png"
  16. >}}
  17. {{< /hackcss-alert >}}
  18. 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.
  19. {{% hackcss-alert type="info" %}}**Tip:** Create a [Custom Layout](/feature/custom-layouts) to show Related Content outside posts.{{% /hackcss-alert %}}
  20. Adjust site-wide maximum from {{< external href="https://gohugo.io/getting-started/configuration/" text="Site Configuration" />}} by adding `related_content_limit`:
  21. ```toml
  22. [params]
  23. related_content_limit = 5 # limit to 5 items maximum site-wide
  24. ```
  25. 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.
  26. For posts, display thumbnail images instead by adding a related limit:
  27. ```toml
  28. [params.layout.post.related]
  29. limit = 3
  30. ```
  31. 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/).
  32. As with homepage thumbnails, image processing may be adjusted:
  33. ```toml
  34. [params.layout.post.related]
  35. limit = 4
  36. thumbs = ["fill", "400x400"] # Optional, thumbnail image processing
  37. ```
  38. Set `limit` to `0` to hide the related content section.
  39. See {{< external href="https://gohugo.io/content-management/related/" text="Related Content in Hugo" />}} for additional configuration options.