fix: typos in property name

This commit is contained in:
Jumpei Ogawa
2024-08-25 12:00:35 +09:00
parent 9e6daa9b74
commit bfa44467bd

View File

@@ -89,19 +89,19 @@ export default ({ config: _themeConfig = 'src/config.yaml' } = {}) => {
const sitemapExists = fs.existsSync(sitemapFile);
if (hasIntegration && sitemapExists) {
const robotsTxt = fs.readFileSync(robotsTxtFile, { encoding: 'utf8', flags: 'a+' });
const robotsTxt = fs.readFileSync(robotsTxtFile, { encoding: 'utf8', flag: 'a+' });
const sitemapUrl = new URL(sitemapName, String(new URL(cfg.base, cfg.site)));
const pattern = /^Sitemap:(.*)$/m;
if (!pattern.test(robotsTxt)) {
fs.appendFileSync(robotsTxtFileInOut, `${os.EOL}${os.EOL}Sitemap: ${sitemapUrl}`, {
encoding: 'utf8',
flags: 'w',
flag: 'w',
});
} else {
fs.writeFileSync(robotsTxtFileInOut, robotsTxt.replace(pattern, `Sitemap: ${sitemapUrl}`), {
encoding: 'utf8',
flags: 'w',
flag: 'w',
});
}
}