Fix broken Search Page OG
The changes to escape characters causes `ctx.query` to be nulled. As a quick fix, stash that value early on.
This commit is contained in:
parent
a50b538ad5
commit
e9214be2c1
1 changed files with 3 additions and 1 deletions
|
@ -321,7 +321,9 @@ async function getHtml(ctx) {
|
||||||
html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
|
html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const query = ctx.query;
|
||||||
const requestPath = unscapeHtmlProperty(decodeURIComponent(ctx.path));
|
const requestPath = unscapeHtmlProperty(decodeURIComponent(ctx.path));
|
||||||
|
|
||||||
if (requestPath.length === 0) {
|
if (requestPath.length === 0) {
|
||||||
const ogMetadata = buildBasicOgMetadata();
|
const ogMetadata = buildBasicOgMetadata();
|
||||||
return insertToHead(html, ogMetadata);
|
return insertToHead(html, ogMetadata);
|
||||||
|
@ -371,7 +373,7 @@ async function getHtml(ctx) {
|
||||||
|
|
||||||
const categoryMetaFn = getCategoryMetaRenderFn(requestPath);
|
const categoryMetaFn = getCategoryMetaRenderFn(requestPath);
|
||||||
if (categoryMetaFn) {
|
if (categoryMetaFn) {
|
||||||
const categoryMeta = categoryMetaFn(ctx.request.query);
|
const categoryMeta = categoryMetaFn(query);
|
||||||
const categoryPageMetadata = buildOgMetadata({
|
const categoryPageMetadata = buildOgMetadata({
|
||||||
...categoryMeta,
|
...categoryMeta,
|
||||||
path: requestPath,
|
path: requestPath,
|
||||||
|
|
Loading…
Add table
Reference in a new issue