2
0

tutorial06.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Tutorial Part 6: Create Categories with Classifiers
  2. ===================================================
  3. Now we actually want to go back to our blog posts and organize them. We can do
  4. that by adding **Classifiers** to our pages so that we can access them via their
  5. category.
  6. What are Classifiers?
  7. ---------------------
  8. Classifiers are essentially categories that you give to an item. For our sweets shop,
  9. classifiers that we might use could be something like:
  10. * **Flavors:** Strawberry, Vanilla, Chocolate, etc.
  11. * **Types of baked goods:** Cupcakes, Cookies, Muffins, Cinnamon Rolls, etc.
  12. * **Types of content:** News, Press, Interviews, Recipes, etc.
  13. Adding Classifiers in the CMS
  14. -----------------------------
  15. You can start adding Classifiers by going to **Snippets > Classifiers**. Select that you want to add a new
  16. Classifier, and you would do this for each Classifier that you want to add.
  17. For the purposes of this tutorial, we are going to add a Content Types classifier and a Baked Goods
  18. classifier.
  19. .. figure:: img/tutorial_new_classifier.png
  20. :alt: Screen for adding a new Classifier.
  21. The admin screen for adding a new Classifier.
  22. The first Classifier we are adding is the Baked Good ones. For Name, we would put Baked Goods because this is the
  23. generalized heading for the category. Then we would click the **Add Classifier Terms** button to begin adding the
  24. sub-categories below that main term.
  25. .. figure:: img/tutorial_edit_classifiers.png
  26. :alt: The Classifiers that we added.
  27. The edit screen for the Classifiers that we added.
  28. However, we realize that you could decide that you want to add Classifiers in the middle of building your pages.
  29. If you have not already added Classifiers in Snippets, you can click the Classify tab in the page editor and
  30. select that you want to create Classifiers. It will take you to the Snippets editor for Classifiers to do so.
  31. Selecting Classifiers for your pages
  32. ------------------------------------
  33. Okay, now we have some Classifiers to work with. Let's head back to our blog posts and start categorizing them.
  34. The Classify tab in our blog posts now show the Classifiers! Take a look at ours:
  35. .. figure:: img/tutorial_blog_classifiers1.png
  36. :alt: The Classifiers are visible in blog pages now.
  37. The edit screen for the Classifiers that we can choose from in a blog post.
  38. You can choose as many Classifiers as you think make sense. For our blog on The Story Behind Our Cupcakes, we
  39. are going to choose Cupcakes (beneath Baked Goods) and News (beneath Content Type).
  40. Using Classifiers across the site
  41. ---------------------------------
  42. One of the places where you might use the Classifiers is in a **Latest Pages** content block. For practice and
  43. to see this in action, let's add a Latest Pages to our Home page. Make sure to add Classifiers to each of your
  44. blog posts first.
  45. .. figure:: img/tutorial_latest_pages_blank.png
  46. :alt: The Latest Pages content block.
  47. The Latest Pages content block.
  48. We could **Choose a Page**, like the Home page and get every sub-page pulled in, or the Blog page and pull in the
  49. sub-pages under Blog. Then we can filter by the Classifiers in the **Classified by** setting. There will be a dropdown
  50. of available Classifiers to choose from.
  51. In this example, we are going to choose the Blog as our **Parent Page** and choose **Content Type > News** for our Classifier.
  52. .. figure:: img/tutorial_example_classified_by.png
  53. :alt: Latest Pages with Parent Page and Classifier filter selected
  54. The Latest Pages with Parent Page and Classifier filter selected
  55. We can choose to also **Show Body Preview** of the pages and the number of pages in this category to show.
  56. When we publish the page, the pages that we selected will show as a list on the page where we added the Latest
  57. Pages block. This is useful for creating a list that automatically updates content if you write more posts with
  58. the Classifier filter that you used.
  59. .. figure:: img/tutorial_basic_pagelist_published.png
  60. :alt: Latest Pages that are published on a web page
  61. The Latest Pages published on a web page
  62. You can also use Classifiers on an Article Landing Page. If we go to our Blog page and look at the Layout tab in
  63. editor mode, we can see our Classifiers in the **Show Child Pages** setting. If we only only wanted to show blog
  64. posts that were under the Baked Goods classifier, for example, we could select that and then the front page for
  65. Blogs would only list our child pages (blog posts) that have been marked as a Baked Goods category.
  66. .. note::
  67. If you're coming from WordPress, you can think of Classifiers as equivalent to WordPress Categories
  68. and Classifier Terms as equivalent to WordPress Taxonomies.
  69. For more info on classifiers, see: :doc:`/features/snippets/classifiers`.