Reputation: 1474
My goal is to edit the HTML header of my wiki articles. I want to add some hreflang
tags, depending on the availability of that particular article in a certain language.
Basically i have got two questions: How do i get the languages before the page is loaded & how do i get the hreflang
tags of these languages into the header?
I have done some searching, but did not find anything on the topic. Is it even possible, to edit the html headers?
Best regards, Max
Upvotes: 0
Views: 1424
Reputation: 8520
For addings link tags (eg <link hreflang>
) you should use OutputPage::addLink. There is also a generic OutputPage::addHeadItem function. In other words, you will do something like this (depending on if you are doing this from an extension, from a skin, or something else):
global $wgOut;
$wgOut->addLink( 'hreflang' => 'fa' );
to create a tag like <link hreflang="fa">
in the page header.
Upvotes: 1