Topic on Extension talk:WikiSEO

Metadata and SEO tags

36
Evolution and evolvability (talkcontribs)

Hello all,

I'm looking to apply metadata tags to WikiJournal articles in order to be compatibel with indexing and tracking services (e.g. AltMetric). Currently I'm using the code:

<div style="display:none"><meta name='citation_doi' value='{{{doi}}}'></div>

Where {{{doi}}} is the article's full doi number. For example in this article, it is included as:

<div style="display:none">&lt;meta name='citation_doi' value='10.15347/wjm/2017.005'&gt;</div>

However, the < and > characters get transcluded as &lt; and &gt; which (I think) prevents it from working properly.

Is Extension:WikiSEO compatible with the requirements of help.altmetric.com/...what-metadata-is-required-to-track-our-content?

(Also posted at Topic:U51g8egyx5j0xixz)

Octfx (talkcontribs)
Luca boscolo (talkcontribs)

Hi,


I have installed WikiSEO 2.6.6 on MediaWiki 1.39.2. I added this to the LocalSettings.php file:


wfLoadExtension( 'WikiSEO' );

$wgMetadataGenerators[] = "Citation";


as per documentation.and then I added this to a page:

{{#seo:
|citation_doi=10.15347/wjm/2017.005
}}

but the page in the <head> section does not have the tag:


<meta name='citation_doi' value='10.15347/wjm/2017.005' />


Any idea?

Thanks.

Octfx (talkcontribs)

The citation generator currently only outputs json. Do you see a <script type=„application/ld+json“> element containing your doi?

Luca boscolo (talkcontribs)

Thank you for the reply. I added this:


{{#seo:|citation_doi=10.15347/wjm/2017.005|citation_type=MedicalScholarlyArticle|citation_name=Cataloging & Classification Quarterly|citation_date_published=2012-01-01|citation_author=Doe, John; Bar, Foo|citation_journal_title=Elsevir|citation_keywords=Keyword a; Keyword b;|description=An article about cataloging}}


on a page, which I copied from the documentation and in the head section I see this:


<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"ScholarlyArticle","name":null,"headline":null,"datePublished":null,"dateCreated":null,"isPartOf":null,"pageStart":null,"sameAs":null,"description":"An article about cataloging","copyrightHolder":null,"license":null,"publisher":null,"keywords":null,"author":[{"@type":"Person","givenName":null,"familyName":"","name":""}]}]}</script>


It seems not working. Anyway, why it is not displaying like this:

<meta name="citation_doi" content="10.1111/1467-9868.03711"/>


I believe this should be the format to get read by the Search Engines.

Octfx (talkcontribs)

That does not sound right. I’ll have a look and get back to you shortly!

Luca boscolo (talkcontribs)

Any news?

Octfx (talkcontribs)

This was indeed a bug. Based on your example I now get the following json output: {"@context":"https:\/\/schema.org","@graph":[{"@type":"MedicalScholarlyArticle","name":"Cataloging & Classification Quarterly","headline":null,"datePublished":"2012-01-01","dateCreated":null,"isPartOf":null,"pageStart":null,"sameAs":"10.15347\/wjm\/2017.005","description":"An article about cataloging","copyrightHolder":"Doe, John; Bar, Foo","license":null,"publisher":null,"keywords":null,"author":[{"@type":"Person","givenName":" John","familyName":"Doe","name":"Doe, John"},{"@type":"Person","givenName":" Foo","familyName":" Bar","name":" Bar, Foo"}]}]}

The patch will be pushed to develop soon.

I did not have the time to implement <meta> tags yet. But I think I will in the following week. Do you have any online resources for valid / required meta tags regarding citation?

Luca boscolo (talkcontribs)

If you do not have much time, you could only do these three for now which are compulsory:

citation_title

citation_author

citation_publication_date


and do the others later on.

Luca boscolo (talkcontribs)
Octfx (talkcontribs)
Luca boscolo (talkcontribs)

@Octfx Thanks, let me know when it is ready, so I'll test it. Yes, it looks relatively straight forward, however, if you feel you do not have much time, you could implement the three mandatory tags I wrote on previous post and do the others next time, I do not mind. Thanks.

Octfx (talkcontribs)
Luca boscolo (talkcontribs)

@Octfx I have installed your changes for WikiSeo on MediaWiki 1.39.2 and got this error now when it starts: Warning: Undefined array key "description" in C:\wamp64\www\wiki-test-1.39.2\extens . The page loads ok when I disable WikiSeo extension in the LocalSettings.php, any idea why?

Luca boscolo (talkcontribs)

@Octfx If it helps, I debugged it and this is the actual error: Warning: Undefined array key "description" in C:\wamp64\www\wiki-test-1.39.2\extensions\WikiSEO\includes\Generator\Plugins\Citation.php on line 144

Octfx (talkcontribs)
Luca boscolo (talkcontribs)

@Octfx Thanks for fixing the issue. I tested it with this:


{{#seo:|title="Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions - Brooks - 2003 - Journal of the Royal Statistical Society: Series B (Statistical Methodology) - Wiley Online Library"|description="Summary. The major implementational problem for reversible jump Markov chain Monte Carlo methods is that there is commonly no natural way to choose jump proposals since there is no Euclidean struct..."|keywords="keyword1; keyword2, keyword3;"|citation_author=S. P. Brooks; P. Giudici; G. O. Roberts|citation_doi=10.15347/wjm/2017.005|citation_journal_title=Journal of the Royal Statistical Society: Series B (Statistical Methodology)|citation_publication_date=2003/01/28|citation_publisher=John Wiley & Sons, Ltd|citation_title=Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions|citation_keywords="Autoregressive time series; Bayesian model selection; Graphical models"}}


and I saw few issues in the generated tags:


1 - The page title is between double quotes, I do not understand why:


<title>"Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions - Brooks - 2003 - Journal of the Royal Statistical Society: Series B (Statistical Methodology) - Wiley Online Library"</title>

2 - same for keywords:

<meta name="keywords" content="&amp;quot;keyword1; keyword2, keyword3;&amp;quot;"/>

3 - the description tag is repeated twice and it is between double quotes:

<meta name="description" content="&amp;quot;Summary. The major implementational problem for reversible jump Markov chain Monte Carlo methods is that there is commonly no natural way to choose jump proposals since there is no Euclidean struct...&amp;quot;"/>

4 - The citation_keywords tag is ignored. This is an example of the expected output:


<meta name="citation_keywords" content="Autoregressive time series">

<meta name="citation_keywords" content="Bayesian model selection">

<meta name="citation_keywords" content="Graphical models">


Thanks.

Octfx (talkcontribs)

Thanks for the report, I’ll have a look why citation_keywords is ignored.

As for the quotes, everything after the = is added as is. As I see you’ve added quotes around the title, they are added to the html Hope this helps!

Luca boscolo (talkcontribs)

@Octfx ok, I see why the double quotes. But why the description meta tag <meta name="description" content=.... is generated twice?

Octfx (talkcontribs)

This was indeed a bug and should now be fixed

Luca boscolo (talkcontribs)

@Octfx any updates for the fix of <meta name="citation_keywords" ?

Octfx (talkcontribs)

Are citation_keywords separate from meta="keywords"?

Luca boscolo (talkcontribs)

@Octfx yes, citation_keywords are separate from meta="keywords"

Octfx (talkcontribs)

You should now be able to set citation_keywords

Luca boscolo (talkcontribs)

@Octfx How do I set the citation_keywords? Are all the keys in the same tag separated by ;? Or one per citation_keywords? Also I have tried this: {{#seo:|title="Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions - Brooks - 2003 - Journal of the Royal Statistical Society: Series B (Statistical Methodology) - Wiley Online Library"|description="Summary. The major implementational problem for reversible jump Markov chain Monte Carlo methods is that there is commonly no natural way to choose jump proposals since there is no Euclidean struct..."|keywords="keyword1; keyword2, keyword3;"|citation_author=S. P. Brooks; P. Giudici; G. O. Roberts|citation_doi=10.15347/wjm/2017.005|citation_journal_title=Journal of the Royal Statistical Society: Series B (Statistical Methodology)|citation_publication_date=2003/01/28|citation_publisher=John Wiley & Sons, Ltd|citation_title=Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions|citation_keywords="Autoregressive time series; Bayesian model selection; Graphical models"}}


The description tags does not get replicated anymore but all the citation tags don't display anymore in the head of the page

Octfx (talkcontribs)

Everything but citation_authors is added as-is to the content of the meta tag, i.e. using |citation_keywords="Keyword1; Keyword2" would result in <meta name="citation_keywords" content="&amp;quot;Keyword1; Keyword2&amp;quot;"/>.

I've called WikiSEO with the following settings:

{{#seo:
|title=Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions - Brooks - 2003 - Journal of the Royal Statistical Society: Series B (Statistical Methodology) - Wiley Online Library
|description=Summary. The major implementational problem for reversible jump Markov chain Monte Carlo methods is that there is commonly no natural way to choose jump proposals since there is no Euclidean struct...
|citation_author=S. P. Brooks; P. Giudici; G. O. Roberts
|citation_doi=10.15347/wjm/2017.005
|citation_journal_title=Journal of the Royal Statistical Society: Series B (Statistical Methodology)
|citation_publication_date=2003/01/28
|citation_publisher=John Wiley & Sons, Ltd
|citation_title=Efficient construction of reversible jump Markov chain Monte Carlo proposal distributions
|citation_keywords=Autoregressive time series, Bayesian model selection, Graphical models
}}

Which resulted in all specified metatags being set in the head, with multiple citation_author tags.

Luca boscolo (talkcontribs)
Luca boscolo (talkcontribs)

@Octfx any updates on this new tag?

Luca boscolo (talkcontribs)

@Octfx thanks for that. With regards the |citation_keywords it should follow the same logic as the |citation_authors, so keywords are separated by a ; and generate one tag for each key, for example: |citation_keywords=Keyword1; Keyword2 would result in two tags: <meta name="citation_keywords" content=Keyword1> and <meta name="citation_keywords" content=Keyword2>. Also I downloaded the latest zip file from master and installed it in MediaWiki 1.39.3. I copied and paste your example in a page, but I still do not see any of the citation tags in the header. I only see title and description. In the Localsettings.php I added these:

# Activate citation tags

$wgMetadataGenerators[] = "Citation";

# Enable Extension:WikiSEO

wfLoadExtension( 'WikiSEO' );

Any idea why?

Luca boscolo (talkcontribs)

@Octfx I have installed WikiSEO in the server and now it displays the citation tags in the head. Strange, is it because they get cached somehow?

81.128.157.66 (talkcontribs)

@Octfx ok, thanks. How do I install the current master? Can I just download current master, unzip, copy and paste the files in the Extensions\WIkiSEO folder?

Luca boscolo (talkcontribs)
Evolution and evolvability (talkcontribs)

@Octfx Aha! Exactly what I was thinking of - definitely useful info. Do you know if it's permitted on WMF wikis?

Octfx (talkcontribs)

That I don't know :/

The code is maintained in WMF Source Control, but to my knowledge noone asked to have it enabled

Evolution and evolvability (talkcontribs)

thanks. I'll look into it a bit further.

Evolution and evolvability (talkcontribs)

I've finally gotten around to requesting the extension enabled on wikiversity (discussion).

Reply to "Metadata and SEO tags"