Add in /salvation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import express from 'express'
|
||||
import path from 'node:path'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { escapeHtml, escapeXml, injectSeoIntoHtml, normalizeSitemapPath } from '../helpers.js'
|
||||
import {
|
||||
@@ -15,6 +16,8 @@ import { DATA_FILE } from '../config.js'
|
||||
import { sanitizeRedirectRules } from '../study-helpers.js'
|
||||
|
||||
export function register(app) {
|
||||
const SALVATION_INDEX_FILE = path.join(DIST_DIR, 'salvation', 'index.html')
|
||||
|
||||
app.get('/robots.txt', async (_req, res) => {
|
||||
let content = state.cachedSiteContent
|
||||
if (!content) {
|
||||
@@ -77,6 +80,13 @@ export function register(app) {
|
||||
app.use('/images', express.static(PUBLIC_IMAGES_DIR))
|
||||
app.use('/uploads', express.static(UPLOADS_DIR))
|
||||
|
||||
// Explicitly serve salvation page on both paths without relying on slash redirects.
|
||||
app.get(['/salvation', '/salvation/'], (_req, res, next) => {
|
||||
res.sendFile(SALVATION_INDEX_FILE, err => {
|
||||
if (err) next()
|
||||
})
|
||||
})
|
||||
|
||||
// Social share stub for questions
|
||||
app.get('/questions/share/:id', (req, res) => {
|
||||
const id = req.params.id
|
||||
|
||||
Reference in New Issue
Block a user