Extension talk:WikiSEO

About this board

author does not appear on information page

1
Tlgonline (talkcontribs)

I operate a public information website using MediaWiki 1.39.3. I recently installed the latest version of this extension. I placed wfLoadExtension('WikiSEO'); in my Local Settings file. I did not configure any of the variables in use by this extension.

Everything works great except that "author" does not appear in the "SEO properties box" contained on the information page. All the other parameters that I set appear as they should.

The relevant part of the "view page source" reads (emphasis added):

<h2 id="mw-pageinfo-header-seo"><span class="mw-headline" id="SEO_properties">SEO properties</span></h2>

<table class="wikitable mw-page-info">

<tr><td style="vertical-align: top;"><h3>Description</h3></td><td><h3>Content</h3></td></tr>

<tr><td style="vertical-align: top;"><b>Page title:</b> (<code>title</code>)<br>This attribute controls the content of the <code>&lt;title&gt;</code> element.</td><td>Texas Legal Guide</td></tr>

<tr><td style="vertical-align: top;"><b>Article author:</b> (<code>author</code>)</td><td><a href="https://texaslegalguide.com/User:Admin"></a></td></tr>

<tr><td style="vertical-align: top;"><b>Article description:</b> (<code>description</code>)<br>This attribute controls the content of the <code>description</code> and <code>og:description</code> elements.</td><td>All TLG legal content is written and/or edited by licensed Texas attorneys. Unless otherwise noted, it is available under the CC BY-NC-ND 4.0 license.</td></tr>

<tr><td style="vertical-align: top;"><b>Keywords:</b> (<code>keywords</code>)<br>This attribute controls the content of the <code>keywords</code> and <code>article:tag</code> elements.</td><td><ul><li>legal information</li><li>questions answers</li><li>attorney directory</li></ul></td></tr>

<tr><td style="vertical-align: top;"><b>Article published date:</b> (<code>published_time</code>)</td><td>02-01-2015</td></tr>

<tr><td style="vertical-align: top;"><b>Article section:</b> (<code>section</code>)</td><td>Law</td></tr>

</table>

Information from <a target="_blank" rel="noreferrer noopener" class="external text" href="https://www.mediawiki.org/wiki/Extension:WikiSEO">Extension:WikiSEO</a>

Reply to "author does not appear on information page"

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"

Content of description tag not properly parsed

2
TaylanKammer (talkcontribs)

With the current version, I'm facing the issue that the content I provide for the description tag don't get properly parsed.

Example:

{{#seo:
| description = Test A: <nowiki> </nowiki> Test B: &#32;
}}

Result:

<meta name="description" content="Test A: &#039;&quot;`UNIQ--nowiki-00000004-QINU`&quot;&#039; Test B: &amp;#32;"/>
Octfx (talkcontribs)

Sorry for the late reply. This has been fixed in the current develop branch and will be available in the next release.

Reply to "Content of description tag not properly parsed"

seo image is added to page, but it does not appear in application/ld+json

6
86.97.130.4 (talkcontribs)

{{#seo:

|title_mode=append
|title=sometitle
|keywords=keyword1, keyword2
|image=someimage.jpg
|site_name=sitename
|type=website
|modified_time=2022-10-30

}}

Hello, the seo image (someimage.jpg) is not appearing in the generated application/ld+json, fall back logo image appears instead.

Mediawiki 1.38

86.97.130.4 (talkcontribs)

Here my my observation on this situation after doing some tests.

It happens on images loaded from Instant Commons. I've tried it on a locally uploaded image and it works. What do you think?

BenMo31 (talkcontribs)

Hello,

I believe it might be related to another issue :


Here : https://github.com/octfx/wiki-seo/blob/master/includes/WikiSEO.php#L267

The return value of the function is always null, even though $param seems to be fine.

This causes the return value of the entire loadPagePropsFromOutputPage() function to be null, because $result ends up empty.


The call to this function is triggered because $properties is also empty here :

https://github.com/octfx/wiki-seo/blob/master/includes/WikiSEO.php#L229


Both of these calls returning empty causes $result to be empty here :

https://github.com/octfx/wiki-seo/blob/master/includes/WikiSEO.php#L107


After, that, the process continues with an empty $this->metadata, and at the next line, here :

https://github.com/octfx/wiki-seo/blob/master/includes/Hooks/PageHooks.php

empty metadata array causes the extension to revert to the default value for the image, defined in LocalSettings.php with $wgWikiSeoDefaultImage in my case.


All my other tags are also ignored, and filled with the default value.

It looks like the metadata aren't saved to (or at least retrieved anymore from) the database, without the extension being able to be backed up by the page content.

Sorry, I can't help you more than that.

If required, I'm on MW v1.38.4

Good luck Octfx :)

BenMo31 (talkcontribs)

I can confirm there is an issue when the metadata are supposed to be inserted in the database.


On an older page, the data were perfectly retrieved from the DB, but as soon as I tried to update the content of the SEO tag, I started to see empty arrays, and the default values for this page too.

86.97.0.62 (talkcontribs)

I've tried it on: MW 1.38.4, 1.38.4.0, 1.35.8, all of them are having the same behavior.

Thank you BenMo31 for clarifying the source cause of that.

92.99.201.84 (talkcontribs)

is it solved?

Reply to "seo image is added to page, but it does not appear in application/ld+json"

PHP Deprecated:  Use of $wgParser 1.38.4

1
86.97.0.62 (talkcontribs)

PHP Deprecated: Use of $wgParser was deprecated in MediaWiki 1.32. [Called from MediaWiki\HookContainer\HookContainer::callLegacyHook in /includes/HookContainer/HookContainer.php at line 338] in /includes/debug/MWDebug.php on line 377


PHP Deprecated: Use of ParserOutput::getProperty was deprecated in MediaWiki 1.38. [Called from MediaWiki\Extension\WikiSEO\Hooks\PageHooks::onRevisionDataUpdates in /extensions/WikiSEO/includes/Hooks/PageHooks.php at line 85] in /includes/debug/MWDebug.php on line 377

Reply to "PHP Deprecated:  Use of $wgParser 1.38.4"

Bringing back the $wgTwitterCardType in the templace

3
Summary by BenMo31

Feature added, thank you !

BenMo31 (talkcontribs)

Hey everyone !

You are doing an amazing work here. Up to date extensions on Mediawiki are priceless :)

I was wondering if you could bring back the $wgTwitterCardType in the template, at some point. It's perfect to have a fallback in the LocalSettings, but I would like to let my users choose the best twitter card for each page, as it depends of the content.

If the content is mostly text-related, the 'summary' setting is fine, but if it's a page with a much better and larger image to illustrate some content, it could be nice to display it with a 'summary with large image', for example.

Thank you again, and keep up the good work !

Octfx (talkcontribs)

Hey there, this should now be possible by using twitter_card=XX.

Changes are live in current master and LTS branches

BenMo31 (talkcontribs)

Amazing, I will try this out very soon !! :)

86.97.130.4 (talkcontribs)

While running maintenance script

php maintenance/GenerateDescription.php --force 0


PHP Warning:  count():Parameter must be an array or an object that implements Countable in ../extensions/WikiSEO/includes/DeferredDescriptionUpdate.php on line 101

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /var/www/html/extensions/WikiSEO/includes/DeferredDescriptionUpdate.php on line 120

Octfx (talkcontribs)

Which version are you using? I think this was fixed a few commits back

86.97.130.4 (talkcontribs)

REL1_38

Octfx (talkcontribs)

Hm, this branch is missing the fix. I'll cherry pick it and give you a notice when the patch is live.

86.97.130.4 (talkcontribs)

Will you update the status here, Thank you

Octfx (talkcontribs)

Bug is now fixed in REL1_38

86.97.130.4 (talkcontribs)

Thank you

PHP Warning:  count()

2
Tim1mike (talkcontribs)

It shows after almost every article when I'm trying to update descriptions via terminal:

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /extensions/WikiSEO/includes/DeferredDescriptionUpdate.php on line 101

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /extensions/WikiSEO/includes/DeferredDescriptionUpdate.php on line 120


MediaWiki 1.38.2

PHP: 7.4.28 (fpm-fcgi)

Is that only my local problem?

IijimaYun (talkcontribs)
Reply to "PHP Warning:  count()"

Installation hack was necessary

2
Summary by Octfx

Folder needs to be named WikiSEO when cloning from git.

BAPhilp (talkcontribs)

YMMV but the instructions on main page did not work until I copied everything from

~/www/extensions/WikiSEO/wiki-seo-master/* down to

~/www/extensions/WikiSEO/

Octfx (talkcontribs)

The very first sentence under "Installation" states: "Download and place the file(s) in a directory called WikiSEO in your extensions/ folder."

Title is not the same as og:title

2
Mukilol2 (talkcontribs)

Hey, according to the documents:

"The title you want to appear in the html title tag. Will also be used for OpenGraph, Schema.org and Twitter metadata."

But the title tag and the og:title tag is different?

On my wiki the page name is "Page A". I set the title to "Page B" with the extension and it changes the title tag to "Page B" but the og:title still says "Page A"?

Octfx (talkcontribs)

This was introduced in Pull Request #19.

I think the reasoning being that the site name is already set in og:site_name.

Where do we go from here? Make this configurable, revert the change?

Reply to "Title is not the same as og:title"
Return to "WikiSEO" page.