summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mehren2020-07-10 12:01:33 +0200
committerGitHub2020-07-10 12:01:33 +0200
commit88b292fbe00216cb0bd2b92d919898f703b7e307 (patch)
tree2a2bdf903de2c1eec30ff5d61d0d677a3efdcb38
parent5b8d948c8cb30071aada0e4ba7d12ab1acfa3776 (diff)
parente4214f32a043acf186b91126a7f9e5f5ab1e4b14 (diff)
Merge pull request #437 from codimd/enhancement/lang-attr-published
Diffstat (limited to '')
-rw-r--r--lib/models/note.js1
-rw-r--r--lib/web/note/util.js1
-rw-r--r--public/views/pretty.ejs2
3 files changed, 3 insertions, 1 deletions
diff --git a/lib/models/note.js b/lib/models/note.js
index 141402ac..edc79639 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -406,6 +406,7 @@ module.exports = function (sequelize, DataTypes) {
if (meta.title && (typeof meta.title === 'string' || typeof meta.title === 'number')) { _meta.title = meta.title }
if (meta.description && (typeof meta.description === 'string' || typeof meta.description === 'number')) { _meta.description = meta.description }
if (meta.robots && (typeof meta.robots === 'string' || typeof meta.robots === 'number')) { _meta.robots = meta.robots }
+ if (meta.lang && (typeof meta.lang === 'string')) { _meta.lang = meta.lang }
if (meta.GA && (typeof meta.GA === 'string' || typeof meta.GA === 'number')) { _meta.GA = meta.GA }
if (meta.disqus && (typeof meta.disqus === 'string' || typeof meta.disqus === 'number')) { _meta.disqus = meta.disqus }
if (meta.slideOptions && (typeof meta.slideOptions === 'object')) { _meta.slideOptions = meta.slideOptions }
diff --git a/lib/web/note/util.js b/lib/web/note/util.js
index c5affd05..f1af1300 100644
--- a/lib/web/note/util.js
+++ b/lib/web/note/util.js
@@ -81,6 +81,7 @@ exports.getPublishData = function (req, res, note, callback) {
const data = {
title: title,
description: meta.description || (markdown ? models.Note.generateDescription(markdown) : null),
+ lang: meta.lang || null,
viewcount: note.viewcount,
createtime: createtime,
updatetime: updatetime,
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 2cf96a7b..51900a4a 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="en">
+<html lang="<%= lang || "en" %>">
<head>
<meta charset="utf-8">