mirror of https://gitlab.com/curben/blog
fix(template): remove null-checking for post.prev.title
This commit is contained in:
parent
b687cd6666
commit
f56b7c176c
|
@ -1,36 +1,36 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<%
|
<%
|
||||||
let title = page.title
|
let title = page.title
|
||||||
|
|
||||||
if (is_archive()) {
|
if (is_archive()) {
|
||||||
title = titleCase(config.archive_dir)
|
title = titleCase(config.archive_dir)
|
||||||
|
|
||||||
if (is_month()) {
|
if (is_month()) {
|
||||||
title += ': ' + page.year + '/' + page.month
|
title += ': ' + page.year + '/' + page.month
|
||||||
} else if (is_year()) {
|
} else if (is_year()) {
|
||||||
title += ': ' + page.year
|
title += ': ' + page.year
|
||||||
} else if (page.current_url) {
|
} else if (page.current_url) {
|
||||||
const pageNum = Number(page.current_url.charAt(page.current_url.length - 2))
|
const pageNum = Number(page.current_url.charAt(page.current_url.length - 2))
|
||||||
if (Number.isInteger(pageNum)) title += ': Page ' + pageNum
|
if (Number.isInteger(pageNum)) title += ': Page ' + pageNum
|
||||||
}
|
|
||||||
} else if (is_category()) {
|
|
||||||
title = __('category') + ': ' + page.category
|
|
||||||
} else if (is_tag()) {
|
|
||||||
title = __('tag') + ': ' + page.tag
|
|
||||||
}
|
}
|
||||||
%>
|
} else if (is_category()) {
|
||||||
|
title = __('category') + ': ' + page.category
|
||||||
|
} else if (is_tag()) {
|
||||||
|
title = __('tag') + ': ' + page.tag
|
||||||
|
}
|
||||||
|
%>
|
||||||
<title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>
|
<title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="canonical" href="<%- full_url_for(path) %>">
|
<link rel="canonical" href="<%- full_url_for(path) %>">
|
||||||
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
|
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
|
||||||
<%/* Modified from original source for compatibility with my blog */%>
|
<%/* Modified from original source for compatibility with my blog */%>
|
||||||
<%- openGraph() %>
|
<%- openGraph() %>
|
||||||
<% if (config.feed) { %>
|
<% if (config.feed) { %>
|
||||||
<%- feed_tag() %>
|
<%- feed_tag() %>
|
||||||
<% } else if (theme.rss) { %>
|
<% } else if (theme.rss) { %>
|
||||||
<%- feed_tag(theme.rss) %>
|
<%- feed_tag(theme.rss) %>
|
||||||
<% } %>
|
<% } %>
|
||||||
<%/* Favicon */%>
|
<%/* Favicon */%>
|
||||||
<%/* https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs */%>
|
<%/* https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs */%>
|
||||||
<link rel="icon" href="<%- url_for('/favicon.ico') %>">
|
<link rel="icon" href="<%- url_for('/favicon.ico') %>">
|
||||||
|
|
|
@ -4,13 +4,7 @@
|
||||||
<% if (post.prev) { %>
|
<% if (post.prev) { %>
|
||||||
<strong><%= __('newer') %></strong>
|
<strong><%= __('newer') %></strong>
|
||||||
<a href="<%- url_for(post.prev.path) %>">
|
<a href="<%- url_for(post.prev.path) %>">
|
||||||
<div class="article-nav-title">
|
<div class="article-nav-title"><%= post.prev.title %></div>
|
||||||
<% if (post.prev.title) { %>
|
|
||||||
<%= post.prev.title %>
|
|
||||||
<% } else { %>
|
|
||||||
(no title)
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue