diff --git a/themes/future/layout/_partial/head.ejs b/themes/future/layout/_partial/head.ejs index 8b88b0fd38c..904b377c9f1 100644 --- a/themes/future/layout/_partial/head.ejs +++ b/themes/future/layout/_partial/head.ejs @@ -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) { + %> + + <% } %> <% if (theme.rss){ %> <% } %>