Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show related posts #1049

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Show related posts #1049

wants to merge 2 commits into from

Conversation

RoneoOrg
Copy link

@RoneoOrg RoneoOrg commented Sep 23, 2022

What does this PR change? What problem does it solve?

Related posts are optionally displayed at the bottom of single.html

Enable with ShowRelatedContent: true in the config file

Was the change discussed in an issue or in the Discussions before?

Yes, see #762

PR Checklist

  • This change adds/updates translations and I have used the template present here.
  • I have enabled maintainer edits for this PR.
  • I have verified that the code works as described/as intended.
  • This change does not include any CDN resources/links.
  • This change does not include any unrelated scripts such as bash and python scripts.

What's left to do?

  • update exampleSite
  • update the wiki

(publishing now to avoid duplicate content from another contributor)

RoneoOrg added a commit to RoneoOrg/hugo-theme-offTheRecord that referenced this pull request Sep 23, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@galElmalah
Copy link

It will be awesome to have this merged :)

@silent1mezzo
Copy link

👍 from me on this!

@@ -0,0 +1,13 @@
{{ $related := first 5 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use Hugo's builtin "related posts" feature? https://gohugo.io/content-management/related/

Using it would be a lot more flexible and users would have a larger range of options to decide how relatedness is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants