Skip to content

Show related posts#1049

Closed
RoneoOrg wants to merge 2 commits intoadityatelange:masterfrom
RoneoOrg:related
Closed

Show related posts#1049
RoneoOrg wants to merge 2 commits intoadityatelange:masterfrom
RoneoOrg:related

Conversation

@RoneoOrg
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown

It will be awesome to have this merged :)

@silent1mezzo
Copy link
Copy Markdown

👍 from me on this!

@@ -0,0 +1,13 @@
{{ $related := first 5 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
Copy link
Copy Markdown
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

no-activity No activity since long time

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants