I'm trying to create a custom pattern for my URL aliases for a custom content type.

I have Token, Pathauto and Views installed.

I want to create an archive of events like this video demonstrates for Drupal 6 using Blogs http://drupal.org/node/247205.

I want my auto URL for posted events to be like website.com/events/01/05/2011/name-of-event

However I want the date information to be taken from a custom date field that the user populates whilst creating the content.

I have attempted something like this: events/[node:field_date:d]/[node:field_date:m]/[node:field_date:Y]/[node:title]

The following error is displayed: The Pattern for all Upcoming Events paths is using the following invalid tokens: [node:field_date:d], [node:field_date:m], [node:field_date:Y].

Perhaps this is not possible, but I find it strange that you can use the node title and even node description but not a custom field for a content type.

Any alternative method for creating an automatic archive of storing event information by year and month would be appreciated.

Comments

rosborn’s picture

You don't mention installing the Date module, which would define the date tokens. I don't know the current status, but you should check out #906622: Cleanup the token code for more information.

spovlot’s picture

The PathAuto configuration screen for Automated URL Aliases provides a list of available tokens for your pattern. So, you can click on the token name to insert it in your patterns. You may need to expand the Field values for Date using the arrow next to the name.

Scott

Shubin’s picture

Thanks, I understand all of that, but what I required was being able to insert a token of a custom date field I created using the Date module. Unfortunately the link the previous poster provided seems to support my initial conclusion of that ability not being possible out of the box.

What I am trying to achieve is an archive whereby the years are displayed on a page and then within them are the months, and inside that are the all the relevant events. I can't use the standard date token as the date I want to filter them by is in putted by the user.

shinz83’s picture

I'm looking for the same thing. I have events that I want to provide an auto URL alias for. But the dates are not showing up in replacement patterns.

Any luck?

moniuch’s picture

@Scott, can the URL replacement pattern have dynamic/variable depth of branches, based upon how deep in taxonomy a term is?

soulston’s picture

I am looking for this functionality also. Currently the path can use:

diary/[node:field_event_date]/[node:title]

but this causes a problem if you have times and start and end dates as the title becomes:

diary/repeats-every-0-days-tuesday-11-october-2011-830pm-1030pm/test-event-next-month

I just want to use the standard diary/yyyy-mm-dd/title format but it's not an option in the patterns and using [node:field_event_date:custom:'Y'] causes an error.

rosborn’s picture

This is addressed in #1103032: Document how to use date tokens. Smarter people than me are working on it.

Anandyrh’s picture

I am looking for the same. adding custom field values works perfect on D6, but could not figure it out on D7. I am looking for events as well, but I don't need to include date in the URL, just to include a custom field value is what I am looking for.

Anandyrh’s picture

Got it working by updating my site's core, and token module to latest

traveller’s picture

For others looking for a solution: I finally pushed Pathauto to generate the URLs mit the date with this snippet: [node:field-date:value:custom:Y-m-d]

Combinations of it, like [node:field-date:value:custom:Y]/[node:field-date:value:custom:m]/[node:field-date:value:custom:d] also work.

kerasai’s picture

@traveller

Are you using recent versions of Token and Date modules?

Edit: I later found out that the tokens mentioned in the previous post were provided by the Entity Tokens module. There is some debate in #1103032: Document how to use date tokens as to whether or not to use this method, take a look and decide what works for you.

Andre-B’s picture

as long as this is still not fixed I found a work around:

using display suite and view modes: (not sure if display suite is needed)

  1. create a new date format (/admin/config/regional/date-time/formats) and date type (/admin/config/regional/date-time)
  2. create a token view mode for your content type
  3. edit the rendering for the date field on the Token view mode to use your new date type style
  4. use token as usual [node:field_date]

follow me on Twitter: https://twitter.com/ABaumeier

dp85’s picture

Thanks, this works for me!

Maybe of interest: I don't use display suite so it's not required for this solution.

ladybug_3777’s picture

Andre-B's suggestion is the only thing that works for me so far! And this is two years later?! WOW

mcretien’s picture

Was looking for something similar: I enabled Entity Tokens which allowed me to use [node:field-date:custom:Y]

Camario39’s picture

Thanks mcretien. entity tokens adds additional options
[node:field-starttime:?]
Field "field_starttime". The following properties may be appended to the token: value (Start date), value2 (End date), duration (Duration)

then you can use PHP formatting of date
[node:field-starttime:value:custom:Y-m-d]

jeremypeter’s picture

I was also able to get this pattern to work with Entity Tokens enabled. This issue could be solved using the pattern:
events/[node:field-date:value:custom:d]/[node:field-date:value:custom:m]/[node:field-date:value:custom:Y]/[node:title]

jumpsuitgreen’s picture

All of the above comments are good and helpful. Unfortunately, they didn't work for my ISO formatted date field. What little hair I didn't pull out turned gray. Good lord…