Improve interstitial behavior

Remove if no password during pre-render
Remove if no password during onFrontMatterChanged
Remove self if on production host
This commit is contained in:
Ludwig Schubert
2018-03-06 16:13:05 -08:00
parent 0bc2ce69da
commit 7ff8796266
3 changed files with 37 additions and 9 deletions
+5 -1
View File
@@ -120,7 +120,11 @@ export const Controller = {
const interstitial = document.querySelector('d-interstitial');
if (interstitial) {
interstitial.password = frontMatter.password;
if (typeof frontMatter.password !== 'undefined') {
interstitial.password = frontMatter.password;
} else {
interstitial.parentElement.removeChild(interstitial);
}
}
const prerendered = document.body.hasAttribute('distill-prerendered');