Adding related links short code and using it #13799
Open
+1,656
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using the Shortcode
Add the following shortcode where you want related posts to appear in your blog post:
The shortcode will display up to 3 related posts in a "You might also like:" section. It automatically excludes the current post from the suggestions.
How Related Posts are Selected
Related posts are configured in
data/related.yaml
with three priority levels:The tag-based entries can be generated by
scripts/python/generate_tag_related.py
, which creates 4 posts per tag (to ensure 3 remain after filtering the current post). They can also be edited by hand.Managing Related Posts
Use these make commands:
Update only new tags (preserves existing):
Regenerate all tags (overwrites existing):