
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gitbook-plugin-head-append
Advanced tools
Append code to the <head>
of the page.
I started from the gitbook-plugin-canonical-link plugin and I adapted it for my own needs (adding the whole realfavicongenerator pacjkage easily).
npm install gitbook-plugin-head-append
Add to book.json
{
"plugins": [
"head-append"
],
"head-append": {
"code": [
"<link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/assets/favicons/apple-touch-icon.png\">",
"<link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/assets/favicons/favicon-32x32.png\">",
"<link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/assets/favicons/favicon-16x16.png\">",
"<link rel=\"manifest\" href=\"/assets/favicons/site.webmanifest\">",
"<link rel=\"mask-icon\" href=\"/assets/favicons/safari-pinned-tab.svg\" color=\"#50ade5\">",
"<link rel=\"shortcut icon\" href=\"/assets/favicons/favicon.ico\">",
"<meta name=\"msapplication-TileColor\" content=\"#ffffff\">",
"<meta name=\"msapplication-config\" content=\"/assets/favicons/browserconfig.xml\">",
"<meta name=\"theme-color\" content=\"#50ade5\">"
]
}
}
}
If you want to add a script you must replace every script
occurrence with SCRIPTTAG
, the plugin will restore it.
"head-append": {
"code": [
"<!-- Global site tag (gtag.js) - Google Analytics -->",
"<SCRIPTTAG async src=\"https://www.googletagmanager.com/gtag/js?id=UA-142637808-2\"></SCRIPTTAG>",
"<SCRIPTTAG>",
" window.dataLayer = window.dataLayer || [];",
" function gtag(){dataLayer.push(arguments);}",
" gtag('js', new Date());",
"",
" gtag('config', 'XXX', { 'anonymize_ip': true });",
"</SCRIPTTAG>"
]
}
That's necessary to avoid the Uncaught SyntaxError: Invalid or unexpected token
JavaScript error.
You can see it in action in the reactjsday-2019-testing-course book.
FAQs
Append code to the <head> of the page
The npm package gitbook-plugin-head-append receives a total of 5 weekly downloads. As such, gitbook-plugin-head-append popularity was classified as not popular.
We found that gitbook-plugin-head-append demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.