1.0.0 • Published 11 months ago
docusaurus-plugin-html-cleanup v1.0.0
docusaurus-plugin-html-cleanup
Overview
This plugin helps clean up the HTML files in a Docusaurus project. It removes unnecessary meta tags, such as the generator meta tag, docusaurus_version meta tag, docusaurus_tag meta tag, removes data-rh="true" attributes, and cleans up empty attributes (like class, target, title, alt) from the generated HTML files.
Features
- Remove Generator Tag: By default, it removes the
generatormeta tag that Docusaurus inserts. - Remove Docusaurus Meta Tags: Removes
docusaurus_version, anddocusaurus_tag, meta tags. - Remove DocSearch Meta Tags: Removes
docsearch:version, anddocsearch:docusaurus_tagmeta tags. - Remove
data-rh="true": Removes thedata-rh="true"attribute fromtitle,meta,link, andscripttags. - Remove Empty Attributes: Cleans up empty attributes like
class,target,title, andalt.
Installation
To install this plugin, run:
npm install docusaurus-plugin-html-cleanupUsage
Once installed, add the plugin to the docusaurus.config.js:
module.exports = {
plugins: [
[
'docusaurus-plugin-html-cleanup',
{
removeGeneratorTag: true,
removeDocusaurusMetaTags: true,
removeDocSearchMetaTags: true,
removeDataRhTrue: true,
removeEmptyAttributes: true,
},
],
],
};Options
You can configure the plugin using the following options:
- removeGeneratorTag: Removes the generator meta tag (default: true).
- removeDocusaurusMetaTags: Removes Docusaurus-related meta tags (default: true).
- removeDocSearchMetaTags: Removes Docsearch-related meta tags (default: true).
- removeDataRhTrue: Removes data-rh="true" from meta and link tags (default: true).
- removeEmptyAttributes: Removes empty attributes like class, target, title, and alt (default: true).
Example
The following configuration will disable some functionality:
module.exports = {
plugins: [
[
'docusaurus-plugin-html-cleanup',
{
removeGeneratorTag: false, // Keep the generator tag
},
],
],
};1.0.0
11 months ago