Hello,
I would like to prevent the content hidden from the following example not only from the visible layout of a page but also from “view source”:
if (personShouldNotSeeThis) {
return (req.data.teaserOnly = true);
}
Then in nunjucks:
{% if not data.teaserOnly or data.widget["include-in-preview"] %}
<stuff></stuff>
{% endif %}
This works great for views nunjucks templates, but the data still appears when you view source, i.e.:
<div
class="apos-area-widget-wrapper "
data-apos-widget-wrapper="content"
>
<div class="apos-area-widget " data-apos-widget="content" data-apos-widget-id="w621938654353100000" data='{"_id":"w62193865435310000","title":"Test Content","include-in-preview":false,"body":{"items":[{"_id":"w134440327208000","type":"apostrophe-rich-text","content":"<p>This should not be showing in page source</p>\n","__docId":"cjjlb36qb001j23l820000","__dotPath":"layout.items.5.body.items.0"}],"type":"area","_docId":"cjjlb36qb001j23l82000000","_dotPath":"layout.items.5.body"},"type":"content","__docId":"cjjlb36qb001j23l82000000","__dotPath":"layout.items.5"}' data-options='{"edit":false}' >
</div>
</div>
Consequently, a tech-savvy user could still grab content that we are trying to keep from them with the teaserOnly trick.
What is the best place to look to prevent this data from making its way to the page source?