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
Date tokens
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.
Use Replacement Patterns
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
Thanks, I understand all of
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.
I'm looking for the same
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?
Dynamic branch depth
@Scott, can the URL replacement pattern have dynamic/variable depth of branches, based upon how deep in taxonomy a term is?
I am looking for this
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.
This is addressed in
This is addressed in #1103032: Document how to use date tokens. Smarter people than me are working on it.
I am looking for the same.
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.
Got it working by updating my
Got it working by updating my site's core, and token module to latest
For others looking for a
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.@travellerAre you using
@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.
as long as this is still not
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)
/admin/config/regional/date-time/formats
) and date type (/admin/config/regional/date-time
)[node:field_date]
follow me on Twitter: https://twitter.com/ABaumeier
Thanks, this works for me!
Thanks, this works for me!
Maybe of interest: I don't use display suite so it's not required for this solution.
Andre-B's suggestion is the
Andre-B's suggestion is the only thing that works for me so far! And this is two years later?! WOW
Entity tokens
Was looking for something similar: I enabled Entity Tokens which allowed me to use [node:field-date:custom:Y]
Entity Tokens works for me
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]
Entity Tokens worked for me as well
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]
Beware ISO Formatted Date fields
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…