hexo-theme-stellar/layout/_partial/main/navbar/breadcrumb.ejs

67 lines
2.8 KiB
Plaintext
Raw Normal View History

2021-02-19 23:33:19 +08:00
<% if (page.breadcrumb != false) { %>
<div class='breadcrumb-navigation'>
<% if (page.layout == 'post') { %>
2021-02-23 21:09:49 +08:00
<%
var firstCat = '';
if (page.categories && page.categories.length > 0) {
firstCat = page.categories.data[0].name;
}
%>
<div id='breadcrumb'<%- category_color(firstCat) %>>
2021-02-19 23:33:19 +08:00
<a class='cap breadcrumb' href='/'><%- __('btn.home') %></a>
<span class="sep"></span>
<a class='cap breadcrumb' href='/'><%- __('btn.blog') %></a>
<% if (page.layout == 'post' && page.categories && page.categories.length > 0) { %>
<span class="sep"></span>
<%- list_categories(page.categories, {
2021-02-23 21:09:49 +08:00
class: 'cap breadcrumb',
2021-02-19 23:33:19 +08:00
show_count: false,
separator: ' <span class="sep"></span> ',
style: 'none'
}) %>
<% } %>
</div>
2021-02-21 17:27:48 +08:00
<div id='post-meta'>
<%- __('meta.created') %>&nbsp;<time datetime='<%- date_xml(page.date) %>'><%- date(page.date, config.date_format) %></time>
2021-02-19 23:33:19 +08:00
</div>
<% } else if (page.layout == 'wiki') { %>
2021-02-23 21:09:49 +08:00
<%
var catPage = '';
site.pages.filter(function (p) {
return p.layout == 'index' && p.title && p.wiki && p.wiki.includes(page.wiki)
}).limit(1).each(function(p) {
catPage = p;
});
%>
<div id='breadcrumb'<%- category_color(catPage.title) %>>
2021-02-19 23:33:19 +08:00
<a class='cap breadcrumb' href='/'><%- __('btn.home') %></a>
<span class="sep"></span>
2021-02-25 13:12:04 +08:00
<% if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) { %>
<a class='cap breadcrumb' href='<%- url_for(md_link(theme.sidebar.menu[page.menu_id])) %>'><%- __(md_text(theme.sidebar.menu[page.menu_id])) %></a>
2021-02-22 14:31:49 +08:00
<% } else { %>
2021-02-22 23:39:41 +08:00
<a class='cap breadcrumb' href='<%- url_for(config.wiki_dir || "/wiki/") %>'><%- __('btn.wiki') %></a>
2021-02-22 14:31:49 +08:00
<% } %>
2021-02-23 21:09:49 +08:00
<% if (catPage && catPage.title && catPage.path) { %>
2021-02-19 23:33:19 +08:00
<span class="sep"></span>
2021-02-23 21:09:49 +08:00
<a class='cap breadcrumb' href='<%- url_for(catPage.path) %>'><%- catPage.title %></a>
<% } %>
2021-02-19 23:33:19 +08:00
<% site.pages.filter(function (p) { %>
2021-02-21 03:13:21 +08:00
<% return p.layout == 'wiki' && p.wiki == page.wiki && p.description %>
2021-02-19 23:33:19 +08:00
<% }).limit(1).each(function(p) { %>
<span class="sep"></span>
<a class='cap breadcrumb' href='<%- url_for(p.path) %>'><%- page.wiki %></a>
<% }); %>
</div>
2021-02-21 17:27:48 +08:00
<div id='post-meta'>
<%- __('meta.updated') %>&nbsp;<time datetime='<%- date_xml(page.updated) %>'><%- date(page.updated, config.date_format) %></time>
</div>
2021-02-19 23:33:19 +08:00
<% } else { %>
2021-02-22 23:07:12 +08:00
<div id='breadcrumb'>
2021-02-19 23:33:19 +08:00
<a class='cap breadcrumb' href='/'><%- __('btn.home') %></a>
<span class="sep"></span>
<a class='cap breadcrumb' href='<%- url_for(page.path) %>'><%- page.title || page.seo_title %></a>
</div>
<% } %>
</div>
<% } %>