Hi,
I’m currently in the testing phase of a bilingual website using RapidWeaver with Foundation 6, Stacks 5, and Total CMS, with plans to launch early next year. My blog has posts in both French and English, and I’m trying to figure out how to automate the creation of hreflang tags for each new blog post using TCMS.
For example, when I create a blog post in French with the URL monsiteweb.fr/blog/la-dissonance-cognitive, I also create an English version with the URL mywebsite.com/en/blog/cognitive-dissonance. I want to automatically generate the following hreflang tags for each post:
<link rel="alternate" href="https://monsiteweb.fr/blog/%blog_url_fr%" hreflang="fr" />
<link rel="alternate" href="https://mywebsite.com/en/blog/%blog_url_en%" hreflang="en" />
I use Pretty URL.
I was thinking of something like the code above, where the %blog_url_fr% and %blog_url_en% placeholders would be dynamically replaced by the URLs from TCMS. However, I’m not sure how to implement this with TCMS or if it’s even possible in the html Head part of each page.
Right now, I’m manually adding these tags into the Head section of each page, which is quite tedious and time-consuming. As the blog grows, this manual process is becoming increasingly impractical.
Is there a way to set up TCMS to automatically insert these hreflang tags in the head section of each blog post based on the content URLs I provide in the CMS? If anyone has done something similar or can point me in the right direction, I would really appreciate your insights!
Thanks in advance for your help!