Skip to content

Commit

Permalink
Remove markdown with meta tags (louislam#4968)
Browse files Browse the repository at this point in the history
Co-authored-by: Frank Elsinga <frank@elsinga.de>
  • Loading branch information
taisei-86 and CommanderStorm authored Jul 31, 2024
1 parent 2c31f3a commit cd5644d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/model/status_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const cheerio = require("cheerio");
const { UptimeKumaServer } = require("../uptime-kuma-server");
const jsesc = require("jsesc");
const googleAnalytics = require("../google-analytics");
const { marked } = require("marked");

class StatusPage extends BeanModel {

Expand Down Expand Up @@ -46,7 +47,11 @@ class StatusPage extends BeanModel {
*/
static async renderHTML(indexHTML, statusPage) {
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);
$("meta[name=description]").attr("content", description155);
Expand Down

0 comments on commit cd5644d

Please sign in to comment.