All changes
This commit is contained in:
parent
593f380581
commit
49f7ec2f5a
60 changed files with 1783 additions and 679 deletions
|
|
@ -46,22 +46,49 @@ pub async fn og_middleware(request: Request, next: Next) -> Response {
|
|||
};
|
||||
|
||||
// Build OG-injected HTML (og=1 triggers heading overlay on screenshot)
|
||||
let og_image_url = if query_string.is_empty() {
|
||||
let is_invite = path.starts_with("/invite/");
|
||||
|
||||
let og_image_url = if is_invite {
|
||||
// Include path= so the screenshot service navigates to /invite/CODE
|
||||
if query_string.is_empty() {
|
||||
format!(
|
||||
"{}/api/screenshot?og=1&path={}",
|
||||
state.public_url, path
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"{}/api/screenshot?og=1&path={}&{}",
|
||||
state.public_url, path, query_string
|
||||
)
|
||||
}
|
||||
} else if query_string.is_empty() {
|
||||
format!("{}/api/screenshot?og=1", state.public_url)
|
||||
} else {
|
||||
format!("{}/api/screenshot?og=1&{}", state.public_url, query_string)
|
||||
};
|
||||
|
||||
let (og_title, og_description) = if is_invite {
|
||||
(
|
||||
"You\u{2019}re invited to Perfect Postcode",
|
||||
"Accept your invitation to explore property prices, energy ratings, crime stats, school ratings, and more across England.",
|
||||
)
|
||||
} else {
|
||||
(
|
||||
"Perfect Postcode \u{2014} Every neighbourhood in England",
|
||||
"Explore property prices, energy ratings, crime stats, school ratings, and more across England on one interactive map.",
|
||||
)
|
||||
};
|
||||
|
||||
let og_tags = format!(
|
||||
r#"<meta property="og:title" content="Perfect Postcode — Every neighbourhood in England" />
|
||||
<meta property="og:description" content="Explore property prices, energy ratings, crime stats, school ratings, and more across England on one interactive map." />
|
||||
r#"<meta property="og:title" content="{og_title}" />
|
||||
<meta property="og:description" content="{og_description}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="{og_image_url}" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Perfect Postcode — Every neighbourhood in England" />
|
||||
<meta name="twitter:description" content="Explore property prices, energy ratings, crime stats, school ratings, and more across England on one interactive map." />"#
|
||||
<meta name="twitter:title" content="{og_title}" />
|
||||
<meta name="twitter:description" content="{og_description}" />"#
|
||||
);
|
||||
|
||||
let html = index_html.replace(OG_PLACEHOLDER, &og_tags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue