You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/manual.txt
+73-1
Original file line number
Diff line number
Diff line change
@@ -384,7 +384,8 @@ previewimage
384
384
but should less than 1 MB and be larger than 300x300 (ideally 600x600).
385
385
386
386
section
387
-
Section for the post (overrides section inferred from path)
387
+
Section for the post (instead of inferring from output path; requires
388
+
``POSTS_SECTION_FROM_META`` setting)
388
389
389
390
template
390
391
Change the template used to render this page/post specific page. That
@@ -743,6 +744,77 @@ posts. This is how many blog engines and CMSes behave. Note that this will
743
744
lead to rebuilding all index pages, which might be a problem for larger blogs
744
745
(with a lot of index pages).
745
746
747
+
748
+
Post taxonomy
749
+
~~~~~~~~~~~~~
750
+
751
+
There are three taxonomy systems in Nikola, or three ways to organize posts. Those are:
752
+
753
+
* tags
754
+
* categories
755
+
* sections
756
+
757
+
Tags and categories are visible on the *Tags and Categories* page, by default available at ``/categories/``. Each tag/category/section has an index page and feeds.
758
+
759
+
Tags
760
+
````
761
+
762
+
Tags are the smallest and most basic of the taxonomy items. A post can have multiple tags, specified using the ``tags`` metadata entry (comma-separated). You should provide many tags to help your readers, and perhaps search engines, find content on your site.
763
+
764
+
Please note that tags are case-sensitive and that you cannot have two tags that differ only in case/punctuation (eg. using ``nikola`` in one post and ``Nikola`` in another will lead to a crash):
765
+
766
+
.. code:: text
767
+
768
+
ERROR: Nikola: You have tags that are too similar: Nikola and nikola
769
+
ERROR: Nikola: Tag Nikola is used in: posts/second-post.rst
770
+
ERROR: Nikola: Tag nikola is used in: posts/1.rst
771
+
772
+
Nikola uses some tags to mark a post as “special” — those are ``draft``, ``private``, ``mathjax`` (for math support).
773
+
774
+
You can also generate a tag cloud with the `tx3_tag_cloud <https://plugins.getnikola.com/#tx3_tag_cloud>`_ plugin.
775
+
776
+
Categories
777
+
``````````
778
+
779
+
The next unit for organizing your content are categories. A post can have only one category, specified with the ``category`` meta tag. Those are *deprecated* and replaced by sections. They are displayed alongside tags. You can have categories and tags with the same name (categories’ RSS and HTML files are prefixed with ``cat_`` by default).
780
+
781
+
Sections
782
+
````````
783
+
784
+
Sections are the newest feature for taxonomy, and are not supported in themes by default. There are two ways to assign a section to a post:
785
+
786
+
* through the directory structure (first directory is the section name, eg. ``/code/my-project/`` is in the `code` category) — your POSTS should have those directories as the second element, eg.
787
+
788
+
.. code:: python
789
+
790
+
POSTS = (
791
+
('posts/code/*.rst', 'code', 'posts'),
792
+
)
793
+
794
+
* through the ``section`` meta field (requires ``POSTS_SECTION_FROM_META`` setting; recommended especially for existing sites which should not change the directory hierarchy)
795
+
796
+
Sections are meant to be used to organize different parts of your blog, parts that are about different topics. Unlike tags, which you should have tens (hundreds?) of, you should ideally have less than 10 sections (though it depends on what your blog needs; there is no hard limit).
797
+
798
+
With sections, you can also use come custom styling — if you install ``husl``, you can use ``post.section_color()`` from within templates to get a distinct color for the section of a post, which you can then use in some inline CSS for the section name.
799
+
800
+
You can find some examples and more information in the `original announcement
There are multiple configuration variables dedicated to each of the three taxonomies. You can set:
807
+
808
+
* ``TAG_PATH``, ``TAGS_INDEX_PATH``, ``CATEGORY_PATH``, ``CATEGORY_PREFIX`` to configure paths used for tags and categories
809
+
* ``POST_SECTION_NAME``, ``POST_SECTION_TITLE`, `TAG_PAGES_TITLES``, ``CATEGORY_PAGES_TITLES`` to set friendly section names and titles for index pages
810
+
* ``POST_SECTION_DESCRIPTIONS``, `TAG_PAGES_DESCRIPTIONS``, ``CATEGORY_PAGES_DESCRIPTIONS`` to set descriptions for each of the items
811
+
* ``POST_SECTION_COLORS`` to customize colors for each section
812
+
* ``CATEGORY_ALLOW_HIERARCHIES`` and ``CATEGORY_OUTPUT_FLAT_HIERARCHIES`` to allow hierarchical categories
813
+
* ``TAG_PAGES_ARE_INDEXES`` and ``CATEGORY_PAGES_ARE_INDEXES`` to display full-size indexes instead of simple post lists
814
+
* ``WRITE_TAG_CLOUDS`` to enable/disable generating tag cloud files
815
+
* ``HIDDEN_TAGS``. ``HIDDEN_CATEGORIES`` to make some tags/categories invisible in lists
816
+
* ``POSTS_SECTION_FROM_META`` to use ``.. section:`` in posts instead of inferring paths from paths
0 commit comments