Minor fixes to Subcategory plugin README

This commit is contained in:
Justin Mayer
2014-02-02 17:52:40 -08:00
parent ce06f87a43
commit 56ca351f98

View File

@@ -2,12 +2,11 @@
Adds support for subcategories in addition to article categories. Adds support for subcategories in addition to article categories.
Subcategories are heirachial. Each subcategory has a parent, which is either a Subcategories are hierarchical. Each subcategory has a parent, which is either a
regular category or another subcategory. regular category or another subcategory.
Feeds can be generated for each subcategory just like categories and tags. Feeds can be generated for each subcategory just like categories and tags.
##Usage## ##Usage##
Subcategories are an extension to categories. Add subcategories to an article's Subcategories are an extension to categories. Add subcategories to an article's
@@ -15,12 +14,12 @@ category metadata using a `/` like this:
Category: Regular Category/Sub-Category/Sub-Sub-category Category: Regular Category/Sub-Category/Sub-Sub-category
then create a `subcategory.html` template in your theme similar to the Then create a `subcategory.html` template in your theme, similar to the
`category.html` or `tag.html` `category.html` or `tag.html` templates.
In your templates `article.category` continues to act the same way. Your In your templates `article.category` continues to act the same way. Your
subcategories are stored in a list `aricles.subcategories`. To create a subcategories are stored in the `articles.subcategories` list. To create
breadcrumb style navigation you might try something like this: breadcrumb-style navigation you might try something like this:
<nav class="breadcrumb"> <nav class="breadcrumb">
<ol> <ol>
@@ -36,42 +35,42 @@ breadcrumb style navigation you might try something like this:
</nav> </nav>
##Subcategory Names## ##Subcategory Names##
Each subcategory's name is a `/` seperated list of it parents and itself.
This is neccesary to keep each subcategory unique. It means you can have Each subcategory's full name is a `/`-separated list of it parents and itself.
`Category 1/Foo` and `Category 2/Foo` and the won't intefere with each other. This is necessary to keep each subcategory unique. It means you can have
`Category 1/Foo` and `Category 2/Foo` and they won't interfere with each other.
Each subcategory has an attribute `shortname` which is just the name without Each subcategory has an attribute `shortname` which is just the name without
it's parents associated. For example if you had its parents associated. For example if you had
Category/Sub Category1/Sub Category2 Category/Sub Category1/Sub Category2
the name for Sub Category 2 would be `Category/Sub Category1/Sub Category2` and the full name for Sub Category2 would be `Category/Sub Category1/Sub Category2` and
the shortname would be `Sub Category2` the "short name" would be `Sub Category2`.
If you need to use the slug, it is generated from the short name, not the full If you need to use the slug, it is generated from the short name not the full
name. name.
##Settings## ##Settings##
Consistent with the default settings for Tags and Categories, the default Consistent with the default settings for Tags and Categories, the default
settings for subcategoris are: settings for subcategories are:
'SUBCATEGORY_SAVE_AS' = os.path.join('subcategory', '{savepath}.html') 'SUBCATEGORY_SAVE_AS' = os.path.join('subcategory', '{savepath}.html')
'SUBCATEGORY_URL' = 'subcategory/(fullurl).html' 'SUBCATEGORY_URL' = 'subcategory/(fullurl).html'
`savepath` and `fullurl` are generated recursively, using slugs. So the full `savepath` and `fullurl` are generated recursively, using slugs. So the full
url would be: URL would be:
category-slug/sub-category-slug/sub-sub-category-slug category-slug/sub-category-slug/sub-sub-category-slug
with `savepath` being similar but joined using `os.path.join` with `savepath` being similar but joined using `os.path.join`.
Similarily you can save a subcategory feeds by adding one of the following Similarly, you can save subcategory feeds by adding one of the following
to your pelicanconf file to your Pelican configuration file:
SUBCATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' SUBCATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
SUBCATEGORY_FEED_RSS = 'feeds/%s.rss.xml' SUBCATEGORY_FEED_RSS = 'feeds/%s.rss.xml'
and this will create a feed with `fullurl` of the subcategory. Eg. and this will create a feed with `fullurl` of the subcategory. For example:
feeds/category/subcategory.atom.xml feeds/category/subcategory.atom.xml