Joaquim Baptista 1568d941da Fix typo. 9 anos atrás
..
test_data c69cf4107d Supports sub-parts, which are articles nested below other articles. 9 anos atrás
README.md c69cf4107d Supports sub-parts, which are articles nested below other articles. 9 anos atrás
__init__.py c69cf4107d Supports sub-parts, which are articles nested below other articles. 9 anos atrás
sub_parts.py 1568d941da Fix typo. 9 anos atrás
test_sub_parts.py 1568d941da Fix typo. 9 anos atrás

README.md

Sub-parts

Use sub-parts to break a very long article in 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.

How to use

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

The 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 plug-in Photos, 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 %}

Known use cases

uses sub-parts and the plug-in Pictures to publish photo galleries with thousands of photos. Sub-parts break the photo galleries into manageable chunks, possibly with different tags and authors.

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 adequate to relate articles spread over time. For example, a 10-part article written over several months, or a large festival with several independent performances.

Sub-part : Subordinates articles to each other, hiding sub-articles from timelines. Sub-parts is adequate to relate 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.