Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/theme/head.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-D1HL4PBRSY"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-D1HL4PBRSY');
</script>
Comment on lines +1 to +8

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Replacing mdBook head template with GA snippet breaks docs rendering

Adding docs/theme/head.hbs with only the GA script overrides mdBook’s default head.hbs rather than appending to it. The default template defines the meta charset, viewport, stylesheet links, and built-in JS; overriding it with just the analytics snippet will produce HTML pages without any of those resources, so the generated docs will render without CSS or behavior. To inject GA code you need to copy the upstream head.hbs and append the snippet, or use additional-js/additional-css instead of replacing the template.

Useful? React with 👍 / 👎.