This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Structured data errors
#1

Hello

Once more, thank you for the great commenting product.

I noticed in my Google search console that Commentics' structured data is no longer compatible with Google. 

The errors are:

Missing field "datePublished"
Missing field "author"

I think these fields could be easily added?

Regards
Niko
Reply
#2

Hi Niko,

Yes that's an easy fix. Just open /comments/frontend/view/default/template/main/comment.tpl and change..

"creator" to "author"

"dateCreated" to "datePublished"

Then clear your template cache in the admin area in Tools -> Clear Cache.

Have you completed the interview?
Reply
#3

Hello Steven

Thank you for the fast reply. I made the changes so let me see if those warnings in the GSC disappear. 

Is there a risk that in future updates these kinds of manual changes will be overwritten and the problems reoccur?

I have copied the default folder to a custom folder where I make the changes. I think this folder won't be modified in the updates?

Regards
Niko
Reply
#4

I'll be applying the changes to the next version anyway so it won't get reverted.

That's right, using a custom theme will protect your template changes.

Have you completed the interview?
Reply
#5

The author problem got fixed in GSC but not the datePubllished.

I did some debugging. The datePublished seems to be under the Person so GSC thinks it is related to the person, not the comment. I moved the line to the top of the template just below where the comment div starts. It works now.

It seems that the permalink metaline (url) has the same problem. It is not a mandatory field but it should be moved too.

Niko
Reply
#6

Okay I don't see that issue on GSC for the demo page where I applied the changes from earlier in this thread.

The indentation suggests that the 'datePublished' and the 'url' are part of the comment rather than the author.

It's saying it's valid (see below image).

   

Have you completed the interview?
Reply
#7

That's weird. I also tested with https://validator.schema.org/ and the validation failed. It said that datePublished was missing even though it was under the Person.

GSC accepted the initial validation after I moved the datePublished line to the top but maybe it was just a coincidence and the real reason was something else. Anyway, it is working now. Smile
Reply
#8

I have one small question.

I want to add the following line to the comment template:
 
<meta itemprop="about" content="{{ page-url-here }}#article">

This would link comments to the article.  The question is if there is a variable containing the page URL.
Reply
#9

Sure, you could use this code:

Code:
<meta itemprop="about" content="<?php echo $this->page->getUrl(); ?>#article">

Have you completed the interview?
Reply
#10

Excellent. Works perfectly.

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)