This commit is contained in:
xaoxuu 2021-02-21 13:44:11 +08:00
parent b0f60fb917
commit 5caa8aa484
8 changed files with 25 additions and 12 deletions

View File

@ -3,6 +3,7 @@ page.menu_id = '404';
page.layout = '404'; page.layout = '404';
page.comment_title = ''; page.comment_title = '';
page.header = false; page.header = false;
page.robots = 'none';
%> %>
<article class='md error-page'> <article class='md error-page'>
<h1><img id='error' src="https://7.dusays.com/2021/02/20/1c830bfcd517d.svg" alt=""></h1> <h1><img id='error' src="https://7.dusays.com/2021/02/20/1c830bfcd517d.svg" alt=""></h1>

View File

@ -17,11 +17,6 @@ function generate_robots() {
} }
if (page.robots) { if (page.robots) {
return '<meta name="robots" content="' + page.robots + '">'; return '<meta name="robots" content="' + page.robots + '">';
} else {
// default rule
if (['post', 'wiki', 'index'].includes(page.layout) == false) {
return '<meta name="robots" content="noindex,nofollow">';
}
} }
} }
function og_args() { function og_args() {

View File

@ -1,3 +1,14 @@
<%
if (page.utterances == undefined) {
page.utterances = theme.comments.utterances;
} else {
for (let key of Object.keys(theme.comments.utterances)) {
if (page.utterances[key] == undefined) {
page.utterances[key] = theme.comments.utterances[key];
}
}
}
%>
<script> <script>
function pjax_utterances(){ function pjax_utterances(){
if(!document.getElementById("utterances"))return; if(!document.getElementById("utterances"))return;
@ -11,16 +22,16 @@
} catch (error) {} } catch (error) {}
var script = document.createElement('script'); var script = document.createElement('script');
script.setAttribute('src','https://utteranc.es/client.js'); script.setAttribute('src','https://utteranc.es/client.js');
script.setAttribute('repo','<%- theme.comments.utterances.repo %>'); script.setAttribute('repo','<%- page.utterances.repo %>');
let issuenumber = '<%- theme.comments.utterances['issue-number'] || page.comment_id %>'; let issuenumber = '<%- page.utterances['issue-number'] || page.comment_id %>';
if (issuenumber) { if (issuenumber) {
script.setAttribute('issue-term', issuenumber); script.setAttribute('issue-term', issuenumber);
} else { } else {
script.setAttribute('issue-term', '<%- theme.comments.utterances['issue-term'] %>'); script.setAttribute('issue-term', '<%- page.utterances['issue-term'] %>');
} }
script.setAttribute('theme', '<%- page.dark ? theme.comments.utterances.theme.dark : theme.comments.utterances.theme.light %>' ); script.setAttribute('theme', '<%- page.dark ? page.utterances.theme.dark : page.utterances.theme.light %>' );
script.setAttribute('label','<%- theme.comments.utterances.label %>'); script.setAttribute('label','<%- page.utterances.label %>');
script.setAttribute('crossorigin','<%- theme.comments.utterances.crossorigin %>'); script.setAttribute('crossorigin','<%- page.utterances.crossorigin %>');
HEAD.appendChild(script); HEAD.appendChild(script);
}, 200) }, 200)
}); });

View File

@ -1,4 +1,5 @@
<% <%
page.robots = 'noindex,follow';
if (page.menu_id == undefined) { if (page.menu_id == undefined) {
page.menu_id = 'post'; page.menu_id = 'post';
} }

View File

@ -1,4 +1,5 @@
<% <%
page.robots = 'noindex,follow';
if (page.menu_id == undefined) { if (page.menu_id == undefined) {
page.menu_id = 'post'; page.menu_id = 'post';
} }

View File

@ -6,6 +6,9 @@ if (page.menu_id == undefined) {
page.menu_id = 'post'; page.menu_id = 'post';
} }
} }
if (page.title && page.wiki) {
page.robots = 'noindex,follow';
}
%> %>
<% if (page.menu_id == 'post') { %> <% if (page.menu_id == 'post') { %>
<%- partial('_partial/main/navbar/list_post') %> <%- partial('_partial/main/navbar/list_post') %>

View File

@ -1,4 +1,5 @@
<% <%
page.robots = 'noindex,follow';
if (page.menu_id == undefined) { if (page.menu_id == undefined) {
page.menu_id = 'post'; page.menu_id = 'post';
} }

View File

@ -10,7 +10,7 @@
justify-content: space-between justify-content: space-between
align-items: center align-items: center
cursor: pointer cursor: pointer
min-width 250px min-width 280px
max-width: 100% max-width: 100%
box-shadow: $boxshadow-card box-shadow: $boxshadow-card
transition: box-shadow transition: box-shadow