opengraph attributes
parent
1d8a54b72f
commit
58ea651668
|
@ -132,6 +132,10 @@ export class HttpServer {
|
||||||
"{{SPACE_PATH}}",
|
"{{SPACE_PATH}}",
|
||||||
spaceServer.pagesPath.replaceAll("\\", "\\\\"),
|
spaceServer.pagesPath.replaceAll("\\", "\\\\"),
|
||||||
)
|
)
|
||||||
|
.replace(
|
||||||
|
"{{DESCRIPTION}}",
|
||||||
|
JSON.stringify(stripHtml(html).substring(0, 255)),
|
||||||
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"{{TITLE}}",
|
"{{TITLE}}",
|
||||||
pageName,
|
pageName,
|
||||||
|
@ -663,3 +667,8 @@ function utcDateString(mtime: number): string {
|
||||||
function authCookieName(host: string) {
|
function authCookieName(host: string) {
|
||||||
return `auth_${host.replaceAll(/\W/g, "_")}`;
|
return `auth_${host.replaceAll(/\W/g, "_")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stripHtml(html: string): string {
|
||||||
|
const regex = /<[^>]*>/g;
|
||||||
|
return html.replace(regex, "");
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" prefix="og: https://ogp.me/ns#">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@ -11,6 +11,9 @@
|
||||||
<meta name="theme-color" content="#262626" media="(prefers-color-scheme: dark)">
|
<meta name="theme-color" content="#262626" media="(prefers-color-scheme: dark)">
|
||||||
|
|
||||||
<title>{{TITLE}}</title>
|
<title>{{TITLE}}</title>
|
||||||
|
<meta property="og:image" content="/.client/logo.png">
|
||||||
|
<meta property="og:description" content={{DESCRIPTION}}>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Some global variables we need to make this work
|
// Some global variables we need to make this work
|
||||||
Deno = {
|
Deno = {
|
||||||
|
|
Loading…
Reference in New Issue