Header prerendering now adds markup directly and adds distill-prerendered tag which TEMPLATE webcomponents now respect

This commit is contained in:
Ludwig Schubert
2019-02-15 17:35:48 -08:00
parent 5d83dbfd61
commit cdfa045a36
8 changed files with 170 additions and 152 deletions
+6 -1
View File
@@ -12,10 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom) {
import { headerTemplate } from '../distill-components/distill-header-template';
export default function(dom, data) {
const headerTag = dom.querySelector('distill-header');
if (!headerTag) {
const header = dom.createElement('distill-header');
header.innerHTML = headerTemplate;
header.setAttribute('distill-prerendered', "");
const body = dom.querySelector('body');
body.insertBefore(header, body.firstChild);
}