6

I'd like to make the Entry URL format of a channel look like this: /news/2015/06/my-slug-here

What would I need to enter into the Entry URL Format field in order to do this?

The closest I could manage was this:

news/{postDate|date("Y")}/{slug}

But that only outputs this: /news/2015/my-slug-here

Thanks for any help.

1 Answer 1

9

You're close! For the month part you need postDate|date("m") (this page has the php date formats).

news/{postDate|date("Y")}/{postDate|date("m")}/{slug}
3
  • 6
    Correct me if I'm wrong, but wouldn't this also work? news/{postDate|date("Y/m")}/{slug} ... You'd put the slash inside the date format, so it won't have to parse postDate twice.
    – Lindsey D
    Commented Jun 13, 2015 at 6:22
  • 1
    Thanks Marion, that worked great. Lindsey's suggestion worked too, thanks.
    – Stephen
    Commented Jun 13, 2015 at 15:06
  • 1
    @Lindsey Hadn't thought of that, but nice improvement. Commented Jun 13, 2015 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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