mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-11 16:54:35 -05:00
Remove markdown with meta tags (#4968)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
2c31f3a2ff
commit
cd5644d6d2
@ -4,6 +4,7 @@ const cheerio = require("cheerio");
|
|||||||
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||||
const jsesc = require("jsesc");
|
const jsesc = require("jsesc");
|
||||||
const googleAnalytics = require("../google-analytics");
|
const googleAnalytics = require("../google-analytics");
|
||||||
|
const { marked } = require("marked");
|
||||||
|
|
||||||
class StatusPage extends BeanModel {
|
class StatusPage extends BeanModel {
|
||||||
|
|
||||||
@ -46,7 +47,11 @@ class StatusPage extends BeanModel {
|
|||||||
*/
|
*/
|
||||||
static async renderHTML(indexHTML, statusPage) {
|
static async renderHTML(indexHTML, statusPage) {
|
||||||
const $ = cheerio.load(indexHTML);
|
const $ = cheerio.load(indexHTML);
|
||||||
const description155 = statusPage.description?.substring(0, 155) ?? "";
|
|
||||||
|
const description155 = marked(statusPage.description ?? "")
|
||||||
|
.replace(/<[^>]+>/gm, "")
|
||||||
|
.trim()
|
||||||
|
.substring(0, 155);
|
||||||
|
|
||||||
$("title").text(statusPage.title);
|
$("title").text(statusPage.title);
|
||||||
$("meta[name=description]").attr("content", description155);
|
$("meta[name=description]").attr("content", description155);
|
||||||
|
Loading…
Reference in New Issue
Block a user