Paywall markup should identify the sections the actual publication treats as gated. A boolean copied onto the article cannot establish that its selectors point to the right content. Build a visible-section map and compare it with the emitted structured data before accepting the release.
Keep this decision separate from authentication. Metadata describes a publishing state;it does not prevent a browser from reading text already delivered to it. The PDF preview decision concerns a separate resource. This guide concerns gated portions inside an HTML article.
The complete fixture below uses harmless fictional text. It is a selector test, not a working paywall. No private report, paid product or access setting is being exposed or changed.
Use the current selector restrictions
Google’s current paywalled-content documentation describes CreativeWork properties for subscription or registration-gated content. Its guidelines say not to nest content sections and to use only class selectors for cssSelector. Follow that supported contract rather than an arbitrary selector that happens to work in a local browser.
The page-level isAccessibleForFree value and each relevant hasPart element describe the gated state. A WebPageElement under hasPart names its section through the class selector. Preserve the difference between that descriptive markup and the publisher’s actual access mechanism.
If content must not be accessible in a visitor’s browser, Google’s guidance says to choose an implementation that does not supply it to that browser. Hiding a complete private report with CSS is not equivalent. The implementation and security owners must approve the actual content-delivery boundary.
Keep the filled section manifest
The fictional article has one public introduction and two separate gated sections. The expected membership is explicit:
| Element ID | Class | Approved state | Expected paywall selector membership |
|---|---|---|---|
| intro | public-intro | Free introduction | None |
| findings | paid-findings | Gated findings | .paid-findings only |
| worksheet | paid-worksheet | Gated worksheet | .paid-worksheet only |
The corresponding harmless document fragment is:
<article>
<p id="intro" class="public-intro">A public explanation of the fictional note.</p>
<section id="findings" class="paid-findings">Fictional subscriber findings.</section>
<section id="worksheet" class="paid-worksheet">Fictional subscriber worksheet.</section>
</article>
The sections are siblings, not nested gated containers. Their IDs make the fixture assertions readable, but the structured-data selectors use the supported class form. Do not replace those with ID selectors merely because the IDs are convenient in a test.
Publish the matching complete paywall object
The following object contains the complete paywall mapping for that fixture. It is not a claim that this minimal educational object satisfies every separate Article-feature requirement. Author, image and other relevant article facts still require their own supported publication record.
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "A fictional workflow research note",
"url": "https://journal.example/notes/workflow",
"isAccessibleForFree": false,
"hasPart": [
{
"@type": "WebPageElement",
"isAccessibleForFree": false,
"cssSelector": ".paid-findings"
},
{
"@type": "WebPageElement",
"isAccessibleForFree": false,
"cssSelector": ".paid-worksheet"
}
]
}
The expected selector union is exactly findings and worksheet. It must exclude intro. Two selectors that both match findings would not cover the worksheet, even if a naive test counted two hasPart entries. Compare actual element identities rather than relying on the number of rows.
Run an exact DOM membership assertion
In a controlled browser fixture, load the harmless fragment and pass the approved object to this check. It reports missing, extra or overlapping membership through exact expected arrays rather than accepting any nonempty result.
function checkPaywall(root, data) {
const expected = {
'.paid-findings': ['findings'],
'.paid-worksheet': ['worksheet']
};
const observed = [];
for (const part of data.hasPart) {
if (!Object.hasOwn(expected, part.cssSelector)) throw new Error('Unexpected selector');
if (part.isAccessibleForFree !== false) throw new Error('Wrong section state');
const ids = [...root.querySelectorAll(part.cssSelector)].map(node => node.id);
if (JSON.stringify(ids) !== JSON.stringify(expected[part.cssSelector])) {
throw new Error('Wrong membership');
}
observed.push(...ids);
}
if (data.isAccessibleForFree !== false) throw new Error('Wrong article state');
if (JSON.stringify(observed.sort()) !== JSON.stringify(['findings', 'worksheet'])) {
throw new Error('Missing or duplicated section');
}
return true;
}
This is deliberately a fixture-specific assertion, not a universal CSS validator. Its expected values come from the approved section manifest. A production publisher should apply its own complete manifest and preserve any relevant supported page variants.
Run the check against the whole document
For the fixture call, pass the actual document as root and the complete printed object as data. Passing only the findings component would test a narrower scope than the public selector declarations. A reused paid-findings class elsewhere in the document could then escape the audit.
Add a fourth harmless element in the local negative fixture:an unrelated footer paragraph with class paid-findings and ID footer-note. The whole-document check must report an extra member instead of accepting the original findings element alone. Then remove the footer mutation and restore the baseline.
Keep the selector class names in a documented shared contract with the template owner. A design refactor can preserve the visible gated sections while changing their class names, leaving the structured-data selectors unmatched. That is a publication defect even if the subscription interface still appears to work. Conversely, a class reused for styling elsewhere can accidentally broaden the described gated region without changing the article text.
Require the wrong mappings to fail
Replace one selector with .missing and require failure. Then use .public-intro and require failure rather than treating the free introduction as a paid section. Finally duplicate the findings entry in place of the worksheet entry. The exact union must detect the missing worksheet and repeated findings.
A separate structural check should catch a gated section nested inside another gated section. A successful querySelectorAll result alone cannot establish compliance with that guideline. Preserve the actual document tree and inspect the relationship between matched containers.
Restore the approved fixture between mutations. Do not redefine its expected IDs after observing a mismatch. The purpose is to test the publisher’s mapping against independent intent, not to approve whatever the generator happened to emit.
Verify delivery without weakening the boundary
For an authorized real release, inspect the public response and the appropriate subscriber state without copying restricted material into an uncontrolled receipt. Confirm that the actual class names survive the production template and match the intended sections. A CMS preview can differ from the served page.
Use the public and private access review for actual delivery permissions. Use the visible-data consistency method to keep descriptive fields tied to the approved page rather than unsupported copy.
Close when the selectors identify exactly the intended gated sections under the supported markup contract, and the access mechanism has its own verified owner. Search crawling, indexing and generated-answer use remain separate questions. This fixture cannot guarantee any of those outcomes or make delivered private text inaccessible.
