Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions themes/future/layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,30 @@
}
%>
<%- open_graph(options) %>
<%
// ページパスのリストを定義
const noindexPaths = [
'articles/index.html',
'tags/index.html',
'categories/index.html'
];

// 年月日のアーカイブパスを動的に追加
for (let year = 2020; year <= new Date().getFullYear(); year++) {
noindexPaths.push(`articles/${year}/index.html`);
for (let month = 1; month <= 12; month++) {
const monthStr = month.toString().padStart(2, '0');
noindexPaths.push(`articles/${year}/${monthStr}/index.html`);
}
}

// 現在のページパスがリストに含まれているか判定
const isNoindexPage = noindexPaths.includes(page.path);

if (isNoindexPage) {
%>
<meta name="robots" content="noindex, follow" />
<% } %>
<% if (theme.rss){ %>
<link rel="alternate" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml">
<% } %>
Expand Down
Loading