3

You're nearly there! You are missing the part that fetches the entries related to your category. With your current set up, you would need to do: {# Get the requested category slug from the URL #} {% set requestedSlug = craft.app.request.segments|last %} {# Fetch the category with that slug #} {% set category = craft.categories() .slug(requestedSlug|...


2

I am doing something similar in using a Structure for the main navigation. Below is what I have. Hope it helps! {% set menu = craft.entries.section('navMain').all() %} <ul> {% nav link in menu %} <li> {% if link.menuEntry|length %} {% if craft.app.request.absoluteUrl == link.menuEntry[0].url %} <a href="{{ link....


2

Since the URL is specific for each multisite, simply do not use section.handle in the structure's URI definition, but go for the term you want as a string instead, e.g. English: {parent.uri ?? 'products'}/{slug} German: {parent.uri ?? 'produkte'}/{slug} French: {parent.uri ?? 'produits'}/{slug} and so on...


2

You need to use newParentId: $navigationItem = new Entry(); $navigationItem->typeId = 4; $navigationItem->sectionId = $navigationSection->id; $navigationItem->title = $entry->title; $navigationItem->newParentId = $herbsNavigationEntry->id; $navigationItem->setFieldValue('navLink', '/tags/' . $entry->slug); if (!Craft::$app->...


2

The only way to do this is to create multiple entry types for your structure section. Each entry type has its own field layout (can have different fields from the other entry types in that section). Sadly, it's not possible to restrict entry types to a particular level in a structure – i.e. if you create "Landing Page" and "Sub Page" ...


2

You can do this in a Single without too much trouble. Your homepage will presumably have its own template, so the simplest solution is to content-manage the fields for your Hero, Intro and Image Slider in the homepage Single, and then in the homepage template, hardcode the channels which will form the source of your main entry loop. That way, your homepage ...


1

Take a database backup first to be on the safe side then run: ./craft utils/repair/section-structure yourStructureHandle See documentation - https://craftcms.com/docs/3.x/console-commands.html#utils-repair-section-structure


1

If you go to that user's account settings, then click on the "Preferences" tab, I'm guessing they have their "Formatting Locale" setting set to Cymraeg.


1

Regarding performance: If you look at the database structure of Craft, you'll see that Matrix content is stored across multiple tables, with each block having its own record, just like entries do. I've never compared calculations, but I'd bet there's no significant difference in the DB performance between your two ideas. Using eager loading you could ...


1

You can now use the filter tag of Twig. So you can just do something like this: {% nav page in subnav|filter(page => page.slug == craft.request.getSegment(page.level) ) %} do some stuff {% endnav %} Another solution would be to print out the children only if the condition is true: {% ifchildren %} {% if page.slug == craft.request.getSegment(...


1

It's not intended behaviour when you're editing an existing entry, and it can't be changed - because it's not meant to be doing it. I noticed this on a site last week, but I can't replicate it right now. I think it'd be worth filing a bug report on https://github.com/craftcms/cms/issues


1

Nevermind - had a typo in my template code. Using "descendantOf" works as advertised!


1

Martin Spain's answer covers a tactical way to handle this, but I thought I'd tackle this a different way. When you use the pre-built routing for entries or categories, Craft does some things behind the scenes to make things easier; for example, it sets the entry or category template variable for you. However, that can make it seem like you can only grab ...


Only top voted, non community-wiki answers of a minimum length are eligible