Skip to content

Commit ad6982e

Browse files
committed
Remove robot meta on note edit page and html template, add prevent crawling header to enhance note privacy
1 parent 949f26a commit ad6982e

File tree

4 files changed

+2
-19
lines changed

4 files changed

+2
-19
lines changed

lib/response.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function responseHackMD(res, note) {
123123
url: config.serverurl,
124124
title: title,
125125
useCDN: config.usecdn,
126-
robots: (meta && meta.robots) || false, //default allow robots
127126
facebook: config.facebook,
128127
twitter: config.twitter,
129128
github: config.github,
@@ -135,7 +134,8 @@ function responseHackMD(res, note) {
135134
res.writeHead(200, {
136135
'Content-Type': 'text/html; charset=UTF-8',
137136
'Cache-Control': 'private',
138-
'Content-Length': buf.length
137+
'Content-Length': buf.length,
138+
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
139139
});
140140
res.end(buf);
141141
}

public/js/extra.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,17 @@ function slugifyWithUTF8(text) {
8181

8282
//parse meta
8383
function parseMeta(md, edit, view, toc, tocAffix) {
84-
var robots = null;
8584
var lang = null;
8685
var dir = null;
8786
var breaks = true;
8887
var spellcheck = false;
8988
if (md && md.meta) {
9089
var meta = md.meta;
91-
robots = meta.robots;
9290
lang = meta.lang;
9391
dir = meta.dir;
9492
breaks = meta.breaks;
9593
spellcheck = meta.spellcheck;
9694
}
97-
//robots meta
98-
var robotsMeta = $('meta[name=robots]');
99-
if (robots) {
100-
if (robotsMeta.length > 0)
101-
robotsMeta.attr('content', robots);
102-
else
103-
$('head').prepend('<meta name="robots" content="' + robots + '">')
104-
}
105-
else
106-
robotsMeta.remove();
10795
//text language
10896
if (lang) {
10997
view.attr('lang', lang);
@@ -504,7 +492,6 @@ function exportToHTML(view) {
504492
html: src[0].outerHTML,
505493
toc: toc.html(),
506494
'toc-affix': tocAffix.html(),
507-
robots: (md && md.meta && md.meta.robots) ? '<meta name="robots" content="' + md.meta.robots + '">' : null,
508495
lang: (md && md.meta && md.meta.lang) ? 'lang="' + md.meta.lang + '"' : null,
509496
dir: (md && md.meta && md.meta.dir) ? 'dir="' + md.meta.dir + '"' : null
510497
};

public/views/head.ejs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
<meta name="apple-mobile-web-app-capable" content="yes">
55
<meta name="apple-mobile-web-app-status-bar-style" content="black">
66
<meta name="mobile-web-app-capable" content="yes">
7-
<% if(typeof robots !== 'undefined' && robots) { %>
8-
<meta name="robots" content="<%- robots %>">
9-
<% } %>
107
<title><%- title %></title>
118
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
129
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">

public/views/html.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<meta name="apple-mobile-web-app-capable" content="yes">
1010
<meta name="apple-mobile-web-app-status-bar-style" content="black">
1111
<meta name="mobile-web-app-capable" content="yes">
12-
{{{robots}}}
1312
<title>
1413
{{title}}
1514
</title>

0 commit comments

Comments
 (0)