I am using the following Typoscript code to generate hreflang tags dynamically.
lib.hreflang = HMENU
lib.hreflang {
special = language
#Sprach IDs eintragen
special.value = 0,1
1 = TMENU
1 {
NO = 1
NO {
stdWrap.cObject = TEXT
stdWrap.cObject {
value = de-AT || de-DE
}
linkWrap = <link rel="alternate" hreflang = "|
doNotLinkIt = 1
after.cObject = TEXT
after.cObject {
stdWrap {
wrap = " href=" | " />
typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=1
returnLast = url
#inkl baseurl
//forceAbsoluteUrl = 1
#ignore querystrings
addQueryString = 1
addQueryString.method = GET
addQueryString.exclude = L,id,cHash,no_cache,gclid,utm_source,utm_medium,utm_campaign
no_cache = 0
}
}
}
}
}
}
It works well - but when I override the path in the page settings of Typo3, it ignores my overrides.
For example I have this page: /blog/nature/
and override the path to /nature/
. Then the hreflang generated by my script still points to /blog/nature/
, which is not ideal, because this site results in a redirect to /nature/
.