Sip set /block canonical url
This commit is contained in:
parent
eeefaa6374
commit
8bc1eaebc0
@ -396,7 +396,7 @@ class Server {
|
|||||||
try {
|
try {
|
||||||
const data = await matchedRoute.sip.getData(matchedRoute.params);
|
const data = await matchedRoute.sip.getData(matchedRoute.params);
|
||||||
logger.info(`sip data fetched for "${req.url}" in ${Date.now() - start}ms`);
|
logger.info(`sip data fetched for "${req.url}" in ${Date.now() - start}ms`);
|
||||||
res.render(matchedRoute.sip.template, { canonical, ogImageUrl, ogTitle, matchedRoute, data });
|
res.render(matchedRoute.sip.template, { canonicalHost: this.canonicalHost, canonical, ogImageUrl, ogTitle, matchedRoute, data });
|
||||||
logger.info(`sip returned "${req.url}" in ${Date.now() - start}ms`);
|
logger.info(`sip returned "${req.url}" in ${Date.now() - start}ms`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err(`failed to sip ${req.url}: ` + (e instanceof Error ? e.message : `${e}`));
|
logger.err(`failed to sip ${req.url}: ` + (e instanceof Error ? e.message : `${e}`));
|
||||||
|
@ -50,6 +50,7 @@ const routes = {
|
|||||||
return {
|
return {
|
||||||
block,
|
block,
|
||||||
transactions,
|
transactions,
|
||||||
|
canonicalPath: `/block/${blockId}`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><%= ogTitle %></title>
|
<title><%= ogTitle %></title>
|
||||||
<link rel="canonical" href="<%= canonical %>" />
|
<% if (data && data.canonicalPath) { %>
|
||||||
|
<link rel="canonical" href="<%= canonicalHost + data.canonicalPath %>" />
|
||||||
|
<% } else { %>
|
||||||
|
<link rel="canonical" href="<%= canonical %>" />
|
||||||
|
<% } %>
|
||||||
<meta name="description" content="The Mempool Open Source Project® - Explore the full Bitcoin ecosystem with mempool.space™"/>
|
<meta name="description" content="The Mempool Open Source Project® - Explore the full Bitcoin ecosystem with mempool.space™"/>
|
||||||
<meta property="og:image" content="<%= ogImageUrl %>"/>
|
<meta property="og:image" content="<%= ogImageUrl %>"/>
|
||||||
<meta property="og:image:type" content="image/png"/>
|
<meta property="og:image:type" content="image/png"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user