feat(theme-nav): remove nav link for current page

This commit is contained in:
Ming Di Leom 2021-02-22 07:00:28 +00:00
parent bc3823248f
commit f9889702b7
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
4 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<article id="<%= post.layout %>-<%= post.slug %>" class="h-entry article article-type-<%= post.layout %>" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting"> <article id="<%= post.layout %>-<%= post.slug %>" class="h-entry article article-type-<%= post.layout %>" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<%- partial('_partial/header', {}, { cache: true }) %> <%- partial('_partial/header', {}, { cache: false }) %>
<hr class="header-hr"> <hr class="header-hr">
<div class="article-inner"> <div class="article-inner">
<%- partial('post/gallery') %> <%- partial('post/gallery') %>

View File

@ -4,7 +4,11 @@
<% if (!theme.menu) { %><a class="main-nav-link" href="<%- config.root %>">Home</a> <% if (!theme.menu) { %><a class="main-nav-link" href="<%- config.root %>">Home</a>
<% } else { %> <% } else { %>
<% for (const i in theme.menu) { %> <% for (const i in theme.menu) { %>
<% if (url_for(theme.menu[i]) !== url_for(page.path)) { %>
<a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a> <a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a>
<% } else { %>
<span class="main-nav-link"><%= i %></span>
<% } %>
<% }} %> <% }} %>
<div class="search-container"> <div class="search-container">
@ -51,7 +55,11 @@
<% if (!theme.menu) { %><a class="mobile-nav-link-a" href="<%- config.root %>">Home</a> <% if (!theme.menu) { %><a class="mobile-nav-link-a" href="<%- config.root %>">Home</a>
<% } else { %> <% } else { %>
<% for (const i in theme.menu) { %> <% for (const i in theme.menu) { %>
<% if (url_for(theme.menu[i]) !== url_for(page.path)) { %>
<a class="mobile-nav-link-a" href="<%- url_for(theme.menu[i]) %>"><%= i %></a> <a class="mobile-nav-link-a" href="<%- url_for(theme.menu[i]) %>"><%= i %></a>
<% } else { %>
<span class="mobile-nav-link-a"><%= i %></span>
<% } %>
<% }} %> <% }} %>
</ul> </ul>
</ul> </ul>

View File

@ -1,5 +1,5 @@
<div class="archive-container"> <div class="archive-container">
<%- partial('_partial/header', {}, { cache: true }) %> <%- partial('_partial/header', {}, { cache: false }) %>
<hr class="header-hr"/> <hr class="header-hr"/>
<%- partial('_partial/archive', {pagination: config.archive, index: true}) %> <%- partial('_partial/archive', {pagination: config.archive, index: true}) %>
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="archive-container"> <div class="archive-container">
<%- partial('_partial/header', {}, { cache: true }) %> <%- partial('_partial/header', {}, { cache: false }) %>
<hr class="header-hr"/> <hr class="header-hr"/>
<h2>Recent posts:</h2> <h2>Recent posts:</h2>
<%- list_posts({ <%- list_posts({