fix: resolve legal/about pages in production, update deploy docs
- Fix markdown file path resolution for SSR production builds - Try multiple paths (public/legal, client/legal) for dev and prod - Update deploy/README.md with frontend deployment instructions - Document PM2, Nginx configuration, and port mapping
This commit is contained in:
@@ -17,12 +17,23 @@ const titleMap: Record<Locale, string> = {
|
||||
en: 'About Us',
|
||||
};
|
||||
|
||||
const filePath = path.resolve('public/legal', locale, 'about_us.md');
|
||||
// Try multiple paths for dev and production environments
|
||||
const possiblePaths = [
|
||||
path.resolve('public/legal', locale, 'about_us.md'),
|
||||
path.resolve('client/legal', locale, 'about_us.md'),
|
||||
path.resolve('../client/legal', locale, 'about_us.md'),
|
||||
];
|
||||
let raw = '';
|
||||
try {
|
||||
raw = fs.readFileSync(filePath, 'utf-8');
|
||||
raw = raw.replace(/^#\s+.+\n*/m, '');
|
||||
} catch {
|
||||
for (const filePath of possiblePaths) {
|
||||
try {
|
||||
raw = fs.readFileSync(filePath, 'utf-8');
|
||||
raw = raw.replace(/^#\s+.+\n*/m, '');
|
||||
break;
|
||||
} catch {
|
||||
// Try next path
|
||||
}
|
||||
}
|
||||
if (!raw) {
|
||||
raw = `Content not available.`;
|
||||
}
|
||||
const content = await marked(raw);
|
||||
|
||||
@@ -46,12 +46,23 @@ const subtitle = subtitleMap[docType]?.[locale] ?? '';
|
||||
const warning = warningMap[locale];
|
||||
const legalTitle = legalTitleMap[locale];
|
||||
|
||||
const filePath = path.resolve('public/legal', locale, `${docType}.md`);
|
||||
// Try multiple paths for dev and production environments
|
||||
const possiblePaths = [
|
||||
path.resolve('public/legal', locale, `${docType}.md`),
|
||||
path.resolve('client/legal', locale, `${docType}.md`),
|
||||
path.resolve('../client/legal', locale, `${docType}.md`),
|
||||
];
|
||||
let raw = '';
|
||||
try {
|
||||
raw = fs.readFileSync(filePath, 'utf-8');
|
||||
raw = raw.replace(/^#\s+.+\n*/m, '');
|
||||
} catch {
|
||||
for (const filePath of possiblePaths) {
|
||||
try {
|
||||
raw = fs.readFileSync(filePath, 'utf-8');
|
||||
raw = raw.replace(/^#\s+.+\n*/m, '');
|
||||
break;
|
||||
} catch {
|
||||
// Try next path
|
||||
}
|
||||
}
|
||||
if (!raw) {
|
||||
raw = `Content not available.`;
|
||||
}
|
||||
const content = await marked(raw);
|
||||
|
||||
Reference in New Issue
Block a user