Package: pelican-neighbors
Neighbor Articles: A Plugin for PelicanNeighbors is a Pelican plugin that adds Next/Previous links to articles.InstallationThis plugin can be installed via:python -m pip install pelican-neighborsUsageThis plugin adds a couple of new variables to the article's context:next_article(newer)prev_article(older)next_article_in_categoryprev_article_in_categorynext_article_in_subcategory#prev_article_in_subcategory#Here is an example on how to add article navigation in your Jinjaarticle.htmltemplate:<ul>{%ifarticle.prev_article%}<li><ahref="{{SITEURL}}/{{article.prev_article.url}}">{{article.prev_article.title}}</a></li>{%endif%}{%ifarticle.next_article%}<li><ahref="{{SITEURL}}/{{article.next_article.url}}">{{article.next_article.title}}</a></li>{%endif%}</ul><ul>{%ifarticle.prev_article_in_category%}<li><ahref="{{SITEURL}}/{{article.prev_article_in_category.url}}">{{article.prev_article_in_category.title}}</a></li>{%endif%}{%ifarticle.next_article_in_category%}<li><ahref="{{SITEURL}}/{{article.next_article_in_category.url}}">{{article.next_article_in_category.title}}</a></li>{%endif%}</ul>More Categories plugin supportYou can use the Neighbors plugin with theMore
Categoriesplugin.Since an article can belong to more than one subcategory, subcategories are
stored in a list. If you have an article with subcategories likefoo/bar/baz, it will belong to both subcategorybarandbar/baz.Subcategory neighbors are added to an article asnext_article_in_subcategory#andprev_article_in_subcategory#, where#is the level of subcategory.Using the example above:subcategory0isfoosubcategory1will befoo/barsubcategory2will befoo/bar/bazSubcategory plugin supportYou can use the Neighbors plugin in conjunction with theSubcategory
plugin.Since an article can belong to more than one subcategory, subcategories are
stored in a list. If you have an article with subcategories likeCategory/Foo/Bar, it will belong to both subcategoryFoo, andFoo/Bar.Subcategory neighbors are added to an article asnext_article_in_subcategory#andprev_article_in_subcategory#where#is the level of subcategory. So
using the example from above,subcategory1will beFoo, andsubcategory2will beFoo/Bar.Template ExamplesThe usage with subcategories from either the Subcategory plugin or the More Categories plugin is:<ul>{%ifarticle.prev_article_in_subcategory1%}<li><ahref="{{SITEURL}}/{{article.prev_article_in_subcategory1.url}}">{{article.prev_article_in_subcategory1.title}}</a></li>{%endif%}{%ifarticle.next_article_in_subcategory1%}<li><ahref="{{SITEURL}}/{{article.next_article_in_subcategory1.url}}">{{article.next_article_in_subcategory1.title}}</a></li>{%endif%}</ul><ul>{%ifarticle.prev_article_in_subcategory2%}<li><ahref="{{SITEURL}}/{{article.prev_article_in_subcategory2.url}}">{{article.prev_article_in_subcategory2.title}}</a></li>{%endif%}{%ifarticle.next_article_in_subcategory2%}<li><ahref="{{SITEURL}}/{{article.next_article_in_subcategory2.url}}">{{article.next_article_in_subcategory2.title}}</a></li>{%endif%}</ul>LimitationsIf an article has multiple categories, only the first category is considered.ContributingContributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting onexisting issues.To start contributing to this plugin, review theContributing to Pelicandocumentation, beginning with theContributing Codesection.