URL handling: verschil tussen versies

Uit Petities
Ga naar: navigatie, zoeken
(nailed it!)
(geen verschil)

Versie van 9 sep 2015 om 14:20

To avoid link rot and optimise search engine results there is a consistent (legacy) way of dealing with URLs on the petities.nl website.

With the 2015 release we need to internationalise this structure. The 2015 will listen to the three domains petities.nl, petitions.nl and petitions.eu. The last two are a language indicator for English as the default language, the first for Dutch.

When a link has ?locale=en as appendix it is redirected to the corresponding page on the petitions.eu domain. When a link ends with ?locale=nl it redirects to the corresponding page on petities.nl. When a link includes ?locale=$$ the page is served in the language $$ indicated with the characters following the = sign. For example petitions.eu/petition/this-is-an-example-of-a-petition?locale=fr will serve the French version of the petition, with the website in the English interface. petities.nl/petitie/dit-is-een-voorbeeld-van-een-petitie?locale=fr will serve the French version in the Dutch interface. When the cached_slug is unique it switches to the appropriate language and domain, with petitions.eu/petition/voici-un-exemple-de-un-pétition for the English interface and petities.nl/petition/voici-un-exemple-de-un-pétition for the Dutch interface.

The database has these fields which supplies important information for URLs:

petitions.subdomain

petitions.cached_slug

offices.subdomain

offices.cached_slug

newsitems.cached_slug

pages.cached_slug

signatures.confirmed

petitions.subdomain

This is the easy domain which can be pronounced on radio, television, by telephone, in person etc. The subdomain is followed by the domain name. For example example.petities.nl or example.petitions.eu. This URL is not served over https but redirects immediately to the following, longer link.

petitions.cached_slug

The long link is the (https) link which should never change and is also fed to the search engine crawlers. In case the title of the petition changes, for example after correcting a typo, the cached slug also changes because it is based on the petition title. The previous cached_slug then redirects to the new one. The structure of such a long link for the petition 'This is an example of a petition' is for example http://petities.nl/petitie/this-is-an-example-of-a-petition or http://petitions.eu/petition/this-is-an-example-of-a-petition

offices.subdomain

The link a petition desk can advertise with, for example cityname.petities.nl and cityname.petitions.eu, not over https.

offices.cached_slug

The is the longer https version of the previous one, but in practise it just means a different order of the domains. For example: http://petities.nl/loket/plaatsnaam for plaatsnaam.petities.nl. Or http://petitions.eu/desk/cityname for cityname.petitions.eu

newsitems.cached_slug

Newsitems for a petition each have their own URL: http://petities.nl/nieuws/link-naar-nieuws-over-petitie In case the item is translated, the translated version gets its own url, for example https://petitions.eu/news/link-to-news-about-petition

pages.cached_slug

There are a handful of pages for the entire site. They also have a permanent location.

signatures.confirmed

Signatures need confirmation on a unique, personal, confidential link served over https. https://petities.nl/ondertekening/anda30characterslongkey for the Dutch version and https://petitions.eu/signature/anda30characterslongkey or https://petitions.nl/signature/anda30characterslongkey for the English version.

Internationalisation

With the internationalisation this structure becomes more complicated. The same petition in two languages should be reachable with both links for each language if the translations differ. If the link is the same in both languages, then the version matching the language setting in the browser should be served. Unless there is an override in the form of a cookie set by the language switcher on our website(s).