I need to add some related posts in the content of an instant articles. I use this WordPress plugin:
https://github.com/Automattic/facebook-instant-articles-wp
My posts have:
<ul class="related-article">
<li>
<a href="http://example.com/"></a>
</li>
</ul>
I add this in my transformer rules
{
"class": "RelatedArticlesRule",
"selector": ".related-article"
},
{
"class": "RelatedItemRule",
"selector": ".related-article li",
"properties": {
"related.url": {
"type": "string",
"selector": "a",
"attribute": "href"
}
}
}
But in trasformer markup the related ul not exists. I need something like that:
<ul class="op-related-article">
<li>
<a href="http://example.com/"></a>
</li>
</ul>
looks like related articles items are checked only inside
RelatedArticlesRule
so your selector is wrong.This should work: