Keyword

Rating Schema Snippet for K2 Articles

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 8 months ago - 9 years 8 months ago #131146 by Mr_Anonymous
Rating Schema Snippet for K2 Articles was created by Mr_Anonymous
I understand that rating schema can be added to K2 by editing the sub-template. Has anyone added the rating schema for K2's star rating? Would you mind sharing your snippet of code you used inside the itemRatingBlock to add the schema please? I am new to schemas and I not sure how to add the rating schema to k2 articles. So any help will be so much helpful please :)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #131147 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Rating Schema Snippet for K2 Articles
At this point I can only point you to documentation since I personally have not implemented it.

This is the documentation for the schema.
schema.org/Rating

The documentation for overriding item.php
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 8 months ago #131148 by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Rating Schema Snippet for K2 Articles
Thanks Krikor for the links. I am used to overriding k2 template and thats pretty easy. However, its only adding schema to k2's rating section I am not sure about. Your link was helpful (i read that last night). Anyhow, I will try to add what I've learnt to the k2 rating and will post it back (probably sometime this week). Hopefully someone can have a look and check if what I have done is right. :)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #131149 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Rating Schema Snippet for K2 Articles
You can share your code here for knowledge purposes.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 8 months ago #131150 by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Rating Schema Snippet for K2 Articles
Hi Krikor,

Here is my incomplete attempt on adding schema to K2 item. I am trying to implement AggregateRating something like this:
Log in  or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #131151 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Rating Schema Snippet for K2 Articles
1) It seems correct. You should build upon the correct rating. As for schemas I am not really the expert.

2) <?php echo $this->item->votingPercentage; ?> Will give you the voting percentage.

3) You should use str_replace() for this one.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 8 months ago #131152 by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Rating Schema Snippet for K2 Articles
Thats perfect. Thank you so much. You have helped a lot. I will add those and will post it back once I've done it. :)

Please Log in or Create an account to join the conversation.

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 8 months ago - 9 years 7 months ago #131153 by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Rating Schema Snippet for K2 Articles
Hi Krikor,

This is what I've done to add the AggregateRating schema to k2's star rating:
Log in  or Create an account to join the conversation.

More
9 years 7 months ago #131154 by Arnold Wender
Replied by Arnold Wender on topic Re: Rating Schema Snippet for K2 Articles
Hello,

Did you figured out how to show only the number of votes, without the language string?

This is how it looks right now on my template:

Attachment not found



Cheers
Attachments:

Please Log in or Create an account to join the conversation.

  • Mr_Anonymous
  • Mr_Anonymous's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 7 months ago #131155 by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Rating Schema Snippet for K2 Articles
Yeah I did.. Have a look at the last meta line here . I've used str_replace() to remove the strings and show only numbers like this:
Log in  or Create an account to join the conversation.