2021-02-22 13:19:21 +08:00
|
|
|
<%
|
2024-01-19 01:05:44 +08:00
|
|
|
const { layout } = page
|
|
|
|
// 是否使用 Heti 布局插件
|
2024-02-12 23:07:56 +08:00
|
|
|
const isUsingHeti = theme.plugins.heti?.enable
|
2024-01-19 01:05:44 +08:00
|
|
|
|
2024-05-13 09:45:38 +08:00
|
|
|
const notebook = theme.notebooks.tree[page.notebook]
|
|
|
|
if (notebook) {
|
|
|
|
page.menu_id ??= notebook.menu_id
|
|
|
|
page.license ??= notebook.license
|
|
|
|
page.share ??= notebook.share
|
|
|
|
}
|
|
|
|
|
2024-01-19 01:05:44 +08:00
|
|
|
// 默认的 menu_id
|
|
|
|
if (page.menu_id == null) {
|
2024-01-20 01:51:09 +08:00
|
|
|
if (page.wiki?.length > 0) {
|
|
|
|
page.menu_id = theme.site_tree.wiki.menu_id
|
|
|
|
} else if (page.topic?.length > 0) {
|
|
|
|
page.menu_id = theme.site_tree.topic.menu_id
|
2024-01-19 01:05:44 +08:00
|
|
|
} else {
|
2024-01-20 01:51:09 +08:00
|
|
|
page.menu_id = theme.site_tree.post.menu_id
|
2024-01-19 01:05:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// 默认的 title
|
|
|
|
if (page.title == null) {
|
|
|
|
if (page.wiki) {
|
|
|
|
page.title = __('btn.wiki')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function articleClass() {
|
|
|
|
var str = `md-text content${scrollreveal(' ')}`
|
|
|
|
if (isUsingHeti) {
|
|
|
|
str += ' heti'
|
|
|
|
}
|
|
|
|
return str
|
|
|
|
}
|
|
|
|
|
2022-10-28 22:58:20 +08:00
|
|
|
function layoutDiv() {
|
2024-01-19 01:05:44 +08:00
|
|
|
var el = ''
|
2024-01-14 16:42:20 +08:00
|
|
|
if (page.nav_tabs) {
|
2024-01-19 01:05:44 +08:00
|
|
|
el += partial('_partial/main/navbar/nav_tabs_blog')
|
2022-10-28 22:58:20 +08:00
|
|
|
}
|
|
|
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
2024-01-30 23:48:00 +08:00
|
|
|
el += partial('_partial/main/navbar/article_banner')
|
2022-10-28 22:58:20 +08:00
|
|
|
}
|
2024-01-19 01:05:44 +08:00
|
|
|
el += `<article class="${articleClass()}">`
|
2022-10-28 22:58:20 +08:00
|
|
|
if (page.content && page.content.length > 0) {
|
2024-01-19 01:05:44 +08:00
|
|
|
el += page.content
|
|
|
|
}
|
2024-05-13 09:45:38 +08:00
|
|
|
if (notebook) {
|
|
|
|
el += partial('_partial/main/notebook/note_tags', { notebook: notebook })
|
|
|
|
}
|
|
|
|
if (layout === 'post' || page.wiki || notebook) {
|
2024-01-19 01:05:44 +08:00
|
|
|
el += partial('_partial/main/article/article_footer')
|
|
|
|
}
|
|
|
|
el += `</article>`
|
|
|
|
if (layout === 'post' || page.wiki) {
|
|
|
|
el += partial('_partial/main/article/read_next')
|
|
|
|
}
|
|
|
|
if (layout === 'post') {
|
|
|
|
el += partial('_partial/main/article/related_posts')
|
2022-10-28 22:58:20 +08:00
|
|
|
}
|
2024-02-12 23:07:56 +08:00
|
|
|
el += partial('_partial/comments/layout')
|
2024-01-19 01:05:44 +08:00
|
|
|
return el
|
2022-10-28 22:58:20 +08:00
|
|
|
}
|
2021-02-22 13:19:21 +08:00
|
|
|
%>
|
2022-10-28 22:58:20 +08:00
|
|
|
|
|
|
|
<%- layoutDiv() %>
|