You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
For SEO reasons it would be nice to have the event date in automaticaly generated aliases, e.g. /eventdetails/fitness-training-2016-02-16.html.
Currently, I think, Contao generates the alias from the event title followed by a unique number if the title isn't unique. Would it be possible to generate the alias from the event title and the start date, then followed by a unique number, if necessary?
The text was updated successfully, but these errors were encountered:
I bet that would interfere with reccuring events.
But you can easily implement Rich-Snippets within your event-Template which is seo-wise much more effective.
// Always prefix the event alias with the start date (yyyy-mm-dd-),
// unless it begins with a date already
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['alias']['save_callback'][] =
function($varValue, DataContainer $dc)
{
if (!empty($varValue) and $dc->activeRecord and !preg_match('/^\d{4}-\d{2}-\d{2}-/', $varValue)) {
$varValue = date('Y-m-d-', $dc->activeRecord->startDate) . $varValue;
}
return $varValue;
}
;
If you want put the date at the end you'd change the pattern to '/-\d{4}-\d{2}-\d{2}$/ and swap date/varValue in the next line. The code does not care (not know) if the alias is automatically generated or not.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For SEO reasons it would be nice to have the event date in automaticaly generated aliases, e.g. /eventdetails/fitness-training-2016-02-16.html.
Currently, I think, Contao generates the alias from the event title followed by a unique number if the title isn't unique. Would it be possible to generate the alias from the event title and the start date, then followed by a unique number, if necessary?
The text was updated successfully, but these errors were encountered: