mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-13 01:54:00 +01:00
fix(seo): honour SITE_URL for blog canonicals (#933)
A build with a custom SITE_URL failed seo-audit on the blog pages: generate-blog.mjs hard-coded https://www.bentopdf.com, and the hand-written blog/author-alam.html carries that origin literally while generate-i18n-pages.mjs only rewrites top-level pages. generate-blog.mjs now reads SITE_URL like its sibling scripts, and enhance-seo-pages.mjs rebases the default origin in dist/blog/*.html to SITE_URL (dist only, no-op for the default URL) through a small side-effect-free helper, scripts/site-origin.mjs, covered by src/tests/site-origin.test.ts.
This commit is contained in:
4 files changed
+87
-6
No files matched your search
@@ -3,13 +3,14 @@ import path from 'path';
|
||||
import { marked } from 'marked';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { serializeJsonLd } from './json-ld.mjs';
|
||||
import { DEFAULT_SITE_URL } from './site-origin.mjs';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const POSTS_DIR = path.resolve(__dirname, '../blog/posts');
|
||||
const BLOG_DIR = path.resolve(__dirname, '../blog');
|
||||
const SITE_URL = 'https://www.bentopdf.com';
|
||||
const SITE_URL = (process.env.SITE_URL || DEFAULT_SITE_URL).replace(/\/+$/, '');
|
||||
const AUTHOR = {
|
||||
name: 'Alam',
|
||||
url: `${SITE_URL}/blog/author-alam`,
|
||||
|
||||
Reference in new issue
Block a user