3

Turns out the error was because {slug} was missing from the Section Setting: Entry URI Format


3

Or will I have to write a temporary custom controller action that I can trigger to loop over all entries to redo their slug? This one. The plugin could then just use StringHelper::asciiString($slug); to do the ASCII conversion and re-save it back to the database.


2

I already found a solution. I just created a simple query: SELECT content.elementId entryId, title, uri FROM `craft_content` content JOIN craft_elements elements ON elements.id = content.elementId JOIN `craft_entries` entries ON entries.`id` = content.`elementId` JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id


2

Update Following your comment, and if I understand well, you already are using a URL for the categories, but want to create kind of a subpage "information" for them. It is a bit more complicated but it can be achieved. What you can do is create a route, either from the control panel or the config/routes.php file in craft/config. It may be easier to do it ...


2

Ah I found it: the option to enter the custom slug is displayed when you uncheck the Title. And I set // don't accept umlauts for slugs 'limitAutoSlugsToAscii' => true, in the config.


2

I don't think the ternary operator does what you want it to do. According to this page, the first part of your URL format would return 1 (true) if the parent uri is not __home__, or an empty string if it is. You could try: { parent.uri != '__home__' ? parent.uri }/{slug}


2

I'd always defer to a Brad Bell answer, but if for some reason you needed to maintain the URI format and wanted to still customize a route you could use the Routes section of settings. https://docs.craftcms.com/v3/routing.html#dynamic-routes


2

In Craft 3 under your section config change the URL config https://docs.craftcms.com/v3/sections-and-entries.html#sections SEE: Entry URI Formats You can select what template it should render and what URL config you want Failing this you can use something more advanced: https://docs.craftcms.com/v3/routing.html#advanced-routing-with-url-rules


2

If I understand your question, you want to combine a Single and a Structure into the same family of URL's, something like this: /services - (Single) /services/service-01 - (Structure Entry) /services/services-01/example-sub-service-01 - (Structure Entry) /services/services-01/example-sub-service-02 - (Structure Entry) /services/service-02 - (Structure ...


2

Because your Entry URI is setup as my-channel/{slug} , When you go to my-channel/post-slug-1 Craft automatically sets the variable 'entry' to the entry post-slug-1. You don't need to loop through the channel at this point. You can just use the entry variable. entry.fieldName entry.slug entry.url etc... So just remove your for loop and use 'entry' Using ...


1

Are you using a relative file path? Try to omit them where you can and see if it resolves?


1

If you know your q variable should be a slug, you can use the .slug query parameter: {# Get the requested entry slug from the URL #} {% set requestedSlug = craft.app.request.getSegment(3) %} {# Fetch the entry with that slug #} {% set entry = craft.entries() .slug(requestedSlug|literal) .one() %} More on how to use this in the Craft 3 docs. I ...


1

Got it to work! I don't know why I made it so complicated in my head, but I ended up using the link id to match with the properties link. {% nav link in menu.all %} <li {% if craft.app.request.absoluteUrl == link.addentry[0].url %} class="active"{% endif %}> <a href="{{ link.addentry[0].url }}">{{ link.title }}{% if link.id == 15 %}&...


1

You have to change the URI format in your section for the specific language. Go to settings -> sections -> your single section, there you'll have a table below and you can insert the URI format you like for every site.


1

Technically it's a combination of the element's slug plus URI that is required to be unique (on a per-locale basis). You can see the logic used and where it's enforced at the code level in ElementHelper::setUniqueURI()


1

Seems like a good case for a simple plugin that listened to the onBeforeSaveEntry event. That plugin could verify the entry is in the section you're looking for, compare the existing slug against any saved in the database and do whatever you want to do from there (set it null, etc.).


1

It could be as easy as training your users to delete the slug. If you delete the slug and save the entry will update it.


1

You could write a simple plugin that listened to the onSaveEntry and perform whatever custom business logic you require for slugs. Don't re-save that entry going through craft()->entries->saveEntry(), though, or else you'll create an infinite loop by firing the onSaveEntry event again. You could either call craft()->elements->saveElement() ...


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