We are trying to implement the flexible-sampling feature to help the search engine to index paywalled content.
The example on Google Developper is quiet clear but maybe to simple: https://developers.google.com/search/docs/data-types/paywalled-content
On most website with lead-in paywall, the text is truncated and an ellipsis is added in the middle of sentence. This is a half free / half paywalled paragrapah.
I am wondering how / where to add the CSS classes to mark this paywall content.
In the following example, the second paragraph is half free / half paywalled.
Here is the free version (truncated):
<div class="content">
<p>this is free and visible for any body</p>
<p>this is <b class="underline">half free...</b></p>
</div>
Here is the full version with the paywall
marker:
<div class="content">
<p>this is free and visible for any body</p>
<p>this is <b class="underline">half free</b>
<span class="paywall"><b class="underline">half paywalled</b> content </span></p>
<p class="paywall">this is visible only if you paid</p>
</div>
If yes, this can really get tricky. We need to close all pending tags, wrap the rest in a span
with the paywalled
class, then re-open all the previous tags and re apply the same CSS, …
Is there a way to handle that simply? Can we mark the "half/half" paragraph as paywalled? Do we mark the "half/half" paragraph as visible and only the follwing as paywalled?
BTW, I'll have to generate those tags with the CSS marker automatically, this is the challenge. Adding a CSS marker on a example is easy, I am wondering how to programmatically generate it.