mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
[Status Page] Add og meta tags
This commit is contained in:
parent
c095767f4a
commit
a674caa520
1 changed files with 6 additions and 1 deletions
|
@ -36,9 +36,10 @@ class StatusPage extends BeanModel {
|
||||||
*/
|
*/
|
||||||
static renderHTML(indexHTML, statusPage) {
|
static renderHTML(indexHTML, statusPage) {
|
||||||
const $ = cheerio.load(indexHTML);
|
const $ = cheerio.load(indexHTML);
|
||||||
|
const description155 = statusPage.description.substring(0, 155);
|
||||||
|
|
||||||
$("title").text(statusPage.title);
|
$("title").text(statusPage.title);
|
||||||
$("meta[name=description]").attr("content", statusPage.description.substring(0, 155));
|
$("meta[name=description]").attr("content", description155);
|
||||||
|
|
||||||
if (statusPage.icon) {
|
if (statusPage.icon) {
|
||||||
$("link[rel=icon]")
|
$("link[rel=icon]")
|
||||||
|
@ -48,6 +49,10 @@ class StatusPage extends BeanModel {
|
||||||
|
|
||||||
const head = $("head");
|
const head = $("head");
|
||||||
|
|
||||||
|
// OG Meta Tags
|
||||||
|
head.append(`<meta property="og:title" content="${statusPage.title}" />`);
|
||||||
|
head.append(`<meta property="og:description" content="${description155}" />`);
|
||||||
|
|
||||||
return $.root().html();
|
return $.root().html();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue