Language attribute on a collection page

It works! I added this code to my Collection page before end of body:

   <script>
 $(document).ready(function() {
  $('html').attr('lang','en');
 });
</script>

And used Add Field functionality from my collection to dynamically add the language code needed. My published page now shows the correct language attribute inside the html tag.

Curios if anyone sees any problem with this SEO wise?
Each item(page) in the collection will have their own language, meta title and description in their own language and the right language attribute. Only problem I can see is the URL’s. It would maybe be better to have folders named /sv and /en and so on but besides from that…

1 Like