So the question is in the title.
How could I add the same static block of HTML code into every page, generated by docusaurus?
Let the sample code be <p>Hello World<p>
, that I would like to insert right after the existing <body>
tag (inserting inside <head>...</head>
s also OK – at the end I need to insert a custom analytics counting script together with some HTML tags)
I have found that injectHtmlTags does that, however I don’t know how to use it.
They reference a non-existing docusaurus-plugin/src/index.js
file. Even if I create the folders and the file with content
export default function (context, options) {
return {
name: 'docusaurus-plugin',
loadContent: async () => {
return {remoteHeadTags: await fetchHeadTagsFromAPI()};
},
injectHtmlTags({content}) {
return {
preBodyTags: [`<p> Hello world </p>`],
};
},
};
}
nothing changes in final (built for production) web-pages.
Should I install some plugin and, if so, how should I do that?
Should I modify docusaurus.config.js
configuration?