67 lines
1.7 KiB
Plaintext
Executable File
67 lines
1.7 KiB
Plaintext
Executable File
<%
|
|
const { layout } = page
|
|
// 是否使用 Heti 布局插件
|
|
const isUsingHeti = theme.plugins.heti && theme.plugins.heti.enable
|
|
// 是否使用 TianliGPT 插件
|
|
const isUsingTianliGPT = theme.plugins.tianli_gpt.enable && ['all', page.layout].includes(theme.plugins.tianli_gpt.field)
|
|
|
|
// 默认的 menu_id
|
|
if (page.menu_id == null) {
|
|
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
|
|
} else {
|
|
page.menu_id = theme.site_tree.post.menu_id
|
|
}
|
|
}
|
|
// 默认的 title
|
|
if (page.title == null) {
|
|
if (page.wiki) {
|
|
page.title = __('btn.wiki')
|
|
}
|
|
}
|
|
|
|
function articleClass() {
|
|
var str = `md-text content${scrollreveal(' ')}`
|
|
if (isUsingHeti) {
|
|
str += ' heti'
|
|
}
|
|
if (isUsingTianliGPT) {
|
|
str += ' '
|
|
}
|
|
return str
|
|
}
|
|
|
|
function layoutDiv() {
|
|
var el = ''
|
|
if (page.nav_tabs) {
|
|
el += partial('_partial/main/navbar/nav_tabs_blog')
|
|
}
|
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
|
el += partial('_partial/main/navbar/article_banner')
|
|
}
|
|
el += `<article class="${articleClass()}">`
|
|
if (page.content && page.content.length > 0) {
|
|
el += page.content
|
|
}
|
|
if (layout === 'post') {
|
|
el += partial('_partial/main/article/article_footer')
|
|
}
|
|
el += `</article>`
|
|
if (layout === 'post' || page.wiki) {
|
|
el += partial('_partial/main/article/read_next')
|
|
}
|
|
if (isUsingTianliGPT) {
|
|
el += partial('_partial/plugins/ai/tianli_gpt')
|
|
}
|
|
if (layout === 'post') {
|
|
el += partial('_partial/main/article/related_posts')
|
|
}
|
|
el += partial('_partial/plugins/comments/layout')
|
|
return el
|
|
}
|
|
%>
|
|
|
|
<%- layoutDiv() %>
|