✨ feat: enhance SSR support with language extraction, dynamic page titles, and updated styles; adjust color theme
This commit is contained in:
@@ -164,6 +164,12 @@ const { ssrRequest } = require("../lib/ssr-server")
|
||||
}
|
||||
|
||||
var tpl = context.fs.readFile("templates/spa.html")
|
||||
|
||||
// Extract language from URL for <html lang="..."> (before other replacements)
|
||||
var langMatch = url.match(/^\/(de|en)(\/|$)/)
|
||||
var pageLang = langMatch ? langMatch[1] : "de"
|
||||
tpl = tpl.replace(/<html lang="[^"]*">/, '<html lang="' + pageLang + '">')
|
||||
|
||||
tpl = tpl.replace("<!--HEAD-->", head)
|
||||
tpl = tpl.replace("<!--HTML-->", html)
|
||||
tpl = tpl.replace("<!--SSR.ERROR-->", error ? "<!--" + error + "-->" : "")
|
||||
|
||||
Reference in New Issue
Block a user