
<?php
$today = time();
$alias = strtolower(date("F-Y",$today));
return $modx->sendRedirect('?q='.$alias);
?>
I actually wouldn’t use ditto as it would likely add unnecessary overhead for the simple task you are trying to perform. Just do the following:
Create a snippet called AliasByDate
<?php $today = time(); $alias = strtolower(date("F-Y",$today)); return $modx->sendRedirect('?q='.$alias); ?>
Then the content of the document called Calendar should only contain the call to the snippet:
[!AliasByDate!]
That should do it. Your breadcrumbs should still work because Calendar is still published and the parent of the children. However, if they go to Calendar, they will always be redirected to the page representing the current month. Unfortunately a weblink doesn’t seem to allow evaluation of MODx tags inside its fields. Now I am not 100% certain this is kosher as far as SEO goes, but I will leave that to others.
Quote from: Jesse at Jan 09, 2008, 02:51 PM
I actually wouldn’t use ditto as it would likely add unnecessary overhead for the simple task you are trying to perform. Just do the following:
Create a snippet called AliasByDate
<?php $today = time(); $alias = strtolower(date("F-Y",$today)); return $modx->sendRedirect('?q='.$alias); ?>
OK, so I just realized that this works in every browser except for Safari, for some reason and I can’t figure out why.
In other browsers the redirect serves up this URL: http://www.stirboston.com/index.php?q=january-2008
In Safari it serves up this URL: http://www.stirboston.com/index.php?q=calendar?q=january-2008 (tacks it on to calendar), which results in an "you’ve reached this page in error" message.
Any idea on how I can fix?
Thanks,
msflux
Then the content of the document called Calendar should only contain the call to the snippet:
[!AliasByDate!]
That should do it. Your breadcrumbs should still work because Calendar is still published and the parent of the children. However, if they go to Calendar, they will always be redirected to the page representing the current month. Unfortunately a weblink doesn’t seem to allow evaluation of MODx tags inside its fields. Now I am not 100% certain this is kosher as far as SEO goes, but I will leave that to others.
Wow, this is awesome and it works perfectly. Thank you so much.