Posts: 25
Threads: 9
Joined: Dec 2022
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
Posts: 2,888
Threads: 59
Joined: Jun 2010
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?
Posts: 25
Threads: 9
Joined: Dec 2022
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
Posts: 2,888
Threads: 59
Joined: Jun 2010
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?
Posts: 25
Threads: 9
Joined: Dec 2022
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
Posts: 2,888
Threads: 59
Joined: Jun 2010
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?
Posts: 25
Threads: 9
Joined: Dec 2022
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.
Posts: 25
Threads: 9
Joined: Dec 2022
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.
Posts: 2,888
Threads: 59
Joined: Jun 2010
Sure, you could use this code:
Code:
<meta itemprop="about" content="<?php echo $this->page->getUrl(); ?>#article">
Have
you completed
the interview?
Posts: 25
Threads: 9
Joined: Dec 2022
Excellent. Works perfectly.
Thank you.