<p>There is no definite answer to your question but I think you can get pretty much what you want using just two types of categories.</p>
<h2>Section setup</h2>
<ol>
<li>create 2 category groups:
<ul>
<li>device types (with the <code>deviceTypes</code>)</li>
<li>post types (with the <code>postTypes</code>)</li>
</ul>
</li>
<li>create an Articles section (with the <code>article</code> handle)</li>
<li>configure you section with the following <strong>Entry URI format</strong>: <code>{articlesDeviceType.slug}/{articlesPostType.slug}/{slug}</code></li>
<li>on the entry type of the <code>articles</code> section (you just need one entry type), add the following required custom fields:
<ul>
<li>Device type (with the <code>articlesDeviceType</code> handle)</li>
<li>Post type (with the <code>articlesPostType</code> handle)</li>
</ul>
</li>
</ol>
<p>Your entries should now have the URL structure you wanted.</p>
<h2>Archive page</h2>
<p>Now if you want an archive of all smartphone related tips, you can get the entries with the following entry query in a template:</p>
<pre><code>{% set tipsCategoryId = craft.categories().group('postTypes').slug('tips').ids() %}
{% set smartphoneCategoryId = craft.categories().group('deviceTypes').slug('smartphones').ids() %}

{% set entryQuery = craft.entries().section('articles').relatedTo([
    'and', 
    { field: 'articlesPostType', targetElement: tipsCategoryId },
    { field: 'articlesDeviceType', targetElement: smartphoneCategoryId },
])
</code></pre>
<p>This should return an <a href="https://craftcms.com/docs/3.x/entries.html#querying-entries" rel="nofollow noreferrer"><code>EntryQuery</code></a> matching all entries <a href="https://craftcms.com/docs/3.x/relations.html" rel="nofollow noreferrer">related to</a> both <code>smartphones</code> device type and <code>tips</code> post type.</p>

CC BY-SA 4.0
2021-03-09T11:30:12.770Z
2021-03-09T11:30:12.770Z
nstCactus
<p>I have a technologies magazine and recently find out about Craft CMS. It looks like I can make everything that I need to but I need advice.</p>
<p>So basically we are writing about smartphones, cars, computers, games and etc. All of these I can put as categories but different posts also have different sub-categories. We split our content into three sub-categories: news, tips, reviews. That means that all the categories (like smartphones, cars and etc.) have the same sub-categories (news, tips, reviews).</p>
<p>I'm looking for the best option for sorting all our content in Craft CMS. I was thinking to use entry types but we also want to have separate archives where people can find only smartphones news or smartphones tips. At the same time, we want to have the archive with all the tips.</p>
<p>The idea is to have a structure like this:</p>
<p>Home -&gt; device type -&gt; post type -&gt; article</p>
<p>Url structure should be with all these components included and all of them should have the archive. I was thinking to use categories for device type and entries type for post type but it gets a bit messy. Does anyone have better ideas on how I can make this thing working for me? Thanks!</p>

<entries><structure>
Whats the best way to place content without using a lot of categories?
# Whats the best way to place content without using a lot of categories?

(Asked by: username_0 on 2021-03-08)

I have a technologies magazine and recently find out about Craft CMS. It looks like I can make everything that I need to but I need advice.

So basically we are writing about smartphones, cars, computers, games and etc. All of these I can put as categories but different posts also have different sub-categories. We split our content into three sub-categories: news, tips, reviews. That means that all the categories (like smartphones, cars and etc.) have the same sub-categories (news, tips, reviews).

I'm looking for the best option for sorting all our content in Craft CMS. I was thinking to use entry types but we also want to have separate archives where people can find only smartphones news or smartphones tips. At the same time, we want to have the archive with all the tips.

The idea is to have a structure like this:

Home -> device type -> post type -> article

Url structure should be with all these components included and all of them should have the archive. I was thinking to use categories for device type and entries type for post type but it gets a bit messy. Does anyone have better ideas on how I can make this thing working for me? Thanks!

**Tags:** entries, structure

---

## 1 answers

### Answer by username_1 on 2021-03-09. Score: 1

There is no definite answer to your question but I think you can get pretty much what you want using just two types of categories.
Section setup

create 2 category groups:

device types (with the deviceTypes)
post types (with the postTypes)


create an Articles section (with the article handle)
configure you section with the following Entry URI format: {articlesDeviceType.slug}/{articlesPostType.slug}/{slug}
on the entry type of the articles section (you just need one entry type), add the following required custom fields:

Device type (with the articlesDeviceType handle)
Post type (with the articlesPostType handle)



Your entries should now have the URL structure you wanted.
Archive page
Now if you want an archive of all smartphone related tips, you can get the entries with the following entry query in a template:
{% set tipsCategoryId = craft.categories().group('postTypes').slug('tips').ids() %}
{% set smartphoneCategoryId = craft.categories().group('deviceTypes').slug('smartphones').ids() %}

{% set entryQuery = craft.entries().section('articles').relatedTo([
    'and', 
    { field: 'articlesPostType', targetElement: tipsCategoryId },
    { field: 'articlesDeviceType', targetElement: smartphoneCategoryId },
])

This should return an EntryQuery matching all entries related to both smartphones device type and tips post type.


---

