Varia's website
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.
 
 
 
 
 
 

3.1 KiB

Sub-parts

Use the Sub-parts plugin to break a very long article in multiple parts, without polluting the timeline with lots of small articles. Sub-parts are removed from timelines and categories but remain in tag and author pages.

Usage

Article sub-parts have a compound slug with the slug of the parent, two hyphens (--), and some identifier. For example, if an article has the slug karate, then an article with the slug karate--medals would be a sub-part.

This convention is very convenient if the slug is derived from the filename. For example, define the filename metadata as follows:

FILENAME_METADATA = '(?P<slug>(?P<date>\d{4}-\d{2}-\d{2})-[^.]+)

Then, it is enough to name the files correctly. In the following example, the first Markdown article has two sub-parts:

./content/blog/2015-03-21-karate.md
./content/blog/2015-03-21-karate--attendees.md
./content/blog/2015-03-21-karate--medals.md

This plugin provides the following variables to your templates and modifies the titles of sub-part articles:

article.subparts: for a parent article with sub-parts, the list of sub-part articles

article.subpart_of: for a sub-part article, the parent article

article.subtitle: the original title of the sub-part article

article.title: compound title with the a comma and the title of the parent

article.subphotos: for parent articles with sub-parts that have a gallery generated by the Photos plugin, the total number of gallery photos in all sub-parts

For example, add the following to the template article.html:

{% if article.subparts %}
<h2>Parts</h2>
<ul>
	{% for part in article.subparts %}
        <li><a href='{{ SITEURL }}/{{ part.url }}'>{{ part.subtitle }}</a>
	{% endfor %}
</ul>
{% endif %}
{% if article.subpart_of %}
<h2>Parts</h2>
<p>This article is part of <a href='{{ SITEURL }}/{{ article.subpart_of.url }}'>{{ article.subpart_of.title }}</a>:</p>
<ul>
	{% for part in article.subpart_of.subparts %}
        <li><a href='{{ SITEURL }}/{{ part.url }}'>{{ part.subtitle }}</a>
	{% endfor %}
</ul>
{% endif %}

Live sites using this plugin

pxquim.pt uses sub-parts and the Photos plugin to publish photo galleries with thousands of photos. The Sub-parts plugin breaks the photo galleries into manageable chunks, possibly with different tags and authors.

pxquim.com uses Sub-parts to cover conferences, where it makes sense to have a sub-part for each speaker.

What is the difference between Sub-part and Series?

Series: Connects separate articles, but never removes articles from timelines. Series is suited to connecting related articles that are published over time, e.g., a ten-part article written over several months, or a large festival with several independent performances.

Sub-part: Articles that are subordinate to each other, hiding sub-articles from timelines. Sub-parts is suited to relating articles clustered together in time, where the sub-articles need the context of their parent article to be fully understood. For example, a 20-part photo gallery of a karate competition, or coverage of a conference.