hexo-theme-stellar/layout/layout.ejs

69 lines
2.3 KiB
Plaintext
Executable File

<%
// 页面类型:索引页面还是内容页面
var page_type = 'index'
if (['post', 'page', 'wiki', null].includes(page.layout)) {
if (!page.nav_tabs) {
page_type = 'content'
}
}
// 文章类型:技术类文章/文学类文章
var article_type = theme.article.type
if (page.type?.length > 0) {
article_type = page.type
} else if (theme.topic.tree[page.topic]?.type != null) {
article_type = theme.topic.tree[page.topic]?.type
} else if (theme.wiki.tree[page.wiki]?.type != null) {
article_type = theme.wiki.tree[page.wiki]?.type
}
// 是否缩进
var indent = false
if (page.indent != null) {
indent = page.indent
} else if (theme.topic.tree[page.topic]?.indent != null) {
indent = theme.topic.tree[page.topic]?.indent
} else if (theme.wiki.tree[page.wiki]?.indent != null) {
indent = theme.wiki.tree[page.wiki]?.indent
} else if (theme.article.indent != null) {
indent = theme.article.indent
} else {
indent = article_type === 'story'
}
var site_background = ''
if (theme.style.site && theme.style.site['background-image']) {
site_background += `<div class="sitebg">`
site_background += `<div class="siteblur"></div>`
site_background += `</div>`
}
var html = `<!DOCTYPE html>`
html += `<html lang="${page.lang}">`
html += partial('_partial/head')
html += `<body>`
html += site_background
html += partial('_partial/cover/index')
html += `<div class="l_body s:aa ${page_type} ${article_type}" id="start" layout="${page.layout}" ${indent ? 'text-indent' : ''}>`
html += `<aside class="l_left">`
html += `<div class="leftbar-container${theme.style.leftbar?.blur ? ' leftbar-blur' : ''}">`
html += partial('_partial/sidebar/index_leftbar')
html += `</div>`
html += `</aside>`
html += `<div class="l_main" id="main">`
html += partial('_partial/sidebar/logo', {where: 'main'})
html += body
html += partial('_partial/main/footer')
html += `<div class="main-mask" onclick="sidebar.dismiss()"></div>`
html += `</div>`
html += `<aside class="l_right">`
html += partial('_partial/sidebar/index_rightbar')
html += `</aside>`
html += partial('_partial/menubtn')
html += `</div>`
html += `<div class="scripts">`
html += partial('_partial/scripts')
html += `</div>`
html += `</body>`
html += `</html>`
%>
<%- html %>