# Category Previews

**URL:** https://meta.discourse.org/t/category-previews/155296
**Category:** Theme component
**Created:** [June 19, 2020, 1:12am UTC](https://meta.discourse.org/t/category-previews/155296 "2020-06-19T01:12:48Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [June 19, 2020, 1:12am UTC](https://meta.discourse.org/t/category-previews/155296/1 "2020-06-19T01:12:48Z")

</div>

This component will allow you to add “category previews” to your categories page so users are able to see that a category exists without having access to the actual category. The preview looks like a standard category, but can link to a specified page where a user can be educated on how to gain access.

I’ve included a simple example below, but there are many different ways this component can be configured. Please be sure to read all of the information included in the Theme Settings.

### Theme Creator Demo

⚠ You will need to be logged into an account here on Meta for this to work

1. Navigate to [https://theme-creator.discourse.org](https://theme-creator.discourse.org) and log-in using the button in the header if you are not already logged-in

2. Use the following link to activate the preview of this component: [Theme Creator](https://theme-creator.discourse.org/theme/tshenry/category-previews)

3. Scroll down the category list until you find the “restricted category preview” category and attempt to enter it:

4. You will be taken to a [published page](https://meta.discourse.org/t/page-publishing/151971) with instructions on how to proceed to access the category:

### Settings

I did my best to explain how this component works in the theme settings. The setup is not the most intuitive experience so feel free to ask questions and I will update the instructions to provide clarity.

 ![Screen Shot 2020-06-18 at 5.38.25 PM](https://global.discourse-cdn.com/meta/original/3X/4/1/41dccf6b48588bfe8018bfa0fb5ac5556037d112.png)

### Additional Notes

I imagine there will be many different edge use-cases. I can’t guarantee that I can make this component work with all of them, but feedback and suggestions are welcome 🙂 Here are some things to keep in mind:

- Currently this will not work with the “Boxes with Featured Topics” or “Subcategories with Featured Topics” category page styles. If there are enough requests, I can see about adding support
- There are `above-$CATEGORY` classes added to the previews that appear above a specific category. This can be used to add additional styling.
- This will not work with sub-categories displayed on the categories page
- Staff users and anonymous users will **always** see the category previews.
- Pay special attention to the **IMPORTANT** notes in the Theme Settings

| | | |
| --- | --- | --- |
| 🛠 | **Repository** | [github.com/tshenry/discourse-category-previews](https://github.com/tshenry/discourse-category-previews) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

---

_[View the full topic](https://meta.discourse.org/t/category-previews/155296)._
