add canonical to the docs (#8731)

This commit is contained in:
Vadim Ogievetsky 2019-10-24 15:25:57 -07:00 committed by Fangjin Yang
parent efd669757e
commit 774ce3ce6d
1 changed files with 12 additions and 0 deletions

View File

@ -40,7 +40,19 @@ try {
from: /\{\{DRUIDVERSION\}\}/g,
to: druidVersion,
});
// Add canonical header
replace.sync({
files: './build/ApacheDruid/docs/**/*.html',
from: /<meta name="generator" content="Docusaurus"\/>/g,
to: (match, fullText, b, filename) => {
const path = filename.replace('./build/ApacheDruid/', '');
return `<link rel="canonical" href="https://druid.apache.org/${path}"/><meta name="generator" content="Docusaurus"/>`;
},
});
console.log('Fixed versions');
} catch (error) {
console.error('Error occurred:', error);
process.exit(1);