0

I'm using an HTML editor so that users can write forum posts. I've taken some time to develop accurate structured data. I'd like to extend that to the links that people share in their forum posts.

The following schema includes an itemprop for significantLink:

https://schema.org/WebPage

One of the more significant URLs on the page. Typically, these are the non-navigation links that are clicked on the most. Supersedes significantLinks.

This would be expressed as follows:

<a itemprop="significantLink" href="http://www.example.com">example</a>

I am using HTMLpurifier to sanitize the user generated HTML. These are my current configuration settings:

require_once 'src/htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('AutoFormat.RemoveEmpty', 'true');
$config->set('AutoFormat.Linkify', 'true');
$purifier = new HTMLPurifier($config);

I wonder, how can I convert ordinary links to add this itemprop using HTMLpurifier?

Amy Neville
  • 10,067
  • 13
  • 58
  • 94
  • Maybe take a look at http://stackoverflow.com/a/29317456/245790 and see if that helps you? – pinkgothic Apr 21 '16 at 11:26
  • Just in case you don’t know: Schema.org offers a specific type for forum posts ([`DiscussionForumPosting`](http://schema.org/DiscussionForumPosting)) which can’t have the `significantLink` property. If you want to use that type (I think you should), you would have to add the links to the `WebPage` item via `itemref` (and a dummy `itemscope`), which is a) ugly and b) probably not accurate (as the links posted in forum posts aren’t necessarily "significant" for the whole web page. – unor Apr 21 '16 at 11:59
  • I have a WebPage itemscope inside a DiscussionForumPosting itemscope - you can do that :) – Amy Neville Apr 22 '16 at 08:52

0 Answers0