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.

taxonomies.md 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. +++
  2. title = "Taxonomies"
  3. weight = 90
  4. +++
  5. Zola has built-in support for taxonomies.
  6. ## Configuration
  7. A taxonomy has five variables:
  8. - `name`: a required string that will be used in the URLs, usually the plural version (i.e., tags, categories, etc.)
  9. - `paginate_by`: if this is set to a number, each term page will be paginated by this much.
  10. - `paginate_path`: if set, this path will be used by the paginated page and the page number will be appended after it.
  11. For example the default would be page/1.
  12. - `rss`: if set to `true`, an RSS feed will be generated for each term.
  13. - `lang`: only set this if you are making a multilingual site and want to indicate which language this taxonomy is for
  14. **Example 1:** (one language)
  15. ```toml
  16. taxonomies = [ name = "categories", rss = true ]
  17. ```
  18. **Example 2:** (multilingual site)
  19. ```toml
  20. taxonomies = [
  21. {name = "tags", lang = "fr"},
  22. {name = "tags", lang = "eo"},
  23. {name = "tags", lang = "en"},
  24. ]
  25. ```
  26. ## Using taxonomies
  27. Once the configuration is done, you can then set taxonomies in your content and Zola will pick them up:
  28. **Example:**
  29. ```toml
  30. +++
  31. title = "Writing a static-site generator in Rust"
  32. date = 2019-08-15
  33. [taxonomies]
  34. tags = ["rust", "web"]
  35. categories = ["programming"]
  36. +++
  37. ```
  38. ## Output paths
  39. In a similar manner to how section and pages calculate their output path:
  40. - the taxonomy name is never slugified
  41. - the taxonomy entry (eg. as specific tag) is slugified when `slugify_paths` is enabled in the configuration
  42. The taxonomy pages are then available at the following paths:
  43. ```plain
  44. $BASE_URL/$NAME/ (taxonomy)
  45. $BASE_URL/$NAME/$SLUG (taxonomy entry)
  46. ```