Domanda

I would change my URL article

www.mynews.fr/news/politic/the-new-gouverner-china

To

www.mynews.fr/news/politic/the-new-gouverner-china-16-06-2013-78965

I would referer my articles in Google Actuality. Thank for your feedback.

È stato utile?

Soluzione

URL are generated according to the 'URL alias name pattern' parameter when editing a class.

This means that if you have a class with a title (string type) and a date (date type) attributes, if you use <title>-<date> in the URL alias name pattern field, the URLs will look like : http://my.domain.com/Titre-article-mardi-23-juillet-2013

Technically the value used by the system to determinate what to use in the URL is given by the title() function of each datatype. Exemple for the date datatype : https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/classes/datatypes/ezdate/ezdatetype.php#L273 The date will be based on your locale but according to the source code I guess that you won't be able to alter the format used (ex: %Y-%m-%d) properly and without hacking the code.

That said, there's not solution to add something else than information coming from content attributes, and node_id is a property of the object, not an attribute.

To solve your issue, I would recommend to create a custom datatype which will not do nothing more but implementing a title() function to return what you want for your URL pattern (in your case, the date in the format you want, plus the node_id).

Hope this helps.

Altri suggerimenti

For the purposes of seo you can submit a google news XML site map and then the number in the URL string is not required.

However, if you want a number in the URL you can add the date attribute to the URL pattern as foobar suggested or you could also add a new identifier attribute to the article class and set it to auto increment with a minimum of 4 or 5 digits then add that attribute to the title.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top