Jump to content

Topic on Extension talk:WikiSEO

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

11
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?

Octfx (talkcontribs)

Sorry, I did not get any notifications for this.

This issue seems to be fixed on the current master branch. Setting an image through |image sets a correct ImageObject in the json+ld output.

5.192.130.122 (talkcontribs)

Well, I'll try and let you know.

2001:8F8:1D53:85E6:EC60:3349:6430:D680 (talkcontribs)

The problem arises when the image is not locally hosted but instead located on commons.

Octfx (talkcontribs)

This should now be fixed in the master branch

2001:8F8:1D5B:C61C:1D17:7FFB:D008:4DFB (talkcontribs)

This is fixed, done.