1

I have a News channel that's looped on an 'News Index' template. Each news entry is linked to its respective link via {{ entry.url }}. In my News channel settings, I have the entry URI format to be news/{postDate.year}/{slug}. However, the {{ entry.url }} link goes to news/{slug}. I assumed that if you set the URI format in the channel settings, it would create entry URLs based on the specified URI format. But that doesn't seem to be working. Can someone let me know where I'm going awry?

4
  • 1
    Please take a look at your sidebar, are there any running tasks? When you change the Uri format in your section, all entries must be saved again. If this task is unable to run, your url won't change – Robin Schambach Aug 14 '18 at 7:42
  • @RobinSchambach I saved the entries again, but that didn't change the URI format. I also emptied the cache, just in case. Not sure if this affects the matter at hand, but my site is localized with two languages, English and Korean. The Entry URI format are both "news/{postDate.year}/{slug}" and "Propagate entries across all enabled sites?" is selected. Also, what should I be looking for on the sidebar? I'm not sure how to tell if there's a task running. – user3092 Aug 14 '18 at 13:50
  • There is a little hint below the last list item in your sidebar that states tasks. You may insert the code above in your title field and store an entry again in order to see the result since your title field behaves as a template as well. At least your code works for me – Robin Schambach Aug 14 '18 at 15:09
  • @RobinSchambach Figured it out. Craft 3 removed the extended DateTime class, so {postDate.year} doesn't work with Craft 3. It must be formatted as {postDate|date('Y')}. – user3092 Aug 14 '18 at 16:46
1

Craft 3 removed the extended DateTime class, so {postDate.year} doesn't work with Craft 3. It must be formatted as {postDate|date('Y')} in the Entry URI format field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.