hexo-theme-stellar/layout/layout.ejs

73 lines
2.5 KiB
Plaintext
Raw Normal View History

2024-01-17 14:07:30 +08:00
<%
2024-01-18 22:11:58 +08:00
// 页面类型:索引页面还是内容页面
2024-01-17 14:07:30 +08:00
var page_type = 'index'
2024-01-18 22:11:58 +08:00
if (['post', 'page', 'wiki', null].includes(page.layout)) {
2024-01-17 14:07:30 +08:00
if (!page.nav_tabs) {
page_type = 'content'
}
}
2024-01-18 22:11:58 +08:00
// 文章类型:技术类文章/文学类文章
var article_type = theme.article.type
if (page.type?.length > 0) {
article_type = page.type
2024-02-03 14:38:34 +08:00
} 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
2024-01-18 22:11:58 +08:00
}
// 是否缩进
var indent = false
if (page.indent != null) {
indent = page.indent
2024-01-19 01:05:44 +08:00
} 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) {
2024-01-18 22:11:58 +08:00
indent = theme.article.indent
} else {
indent = article_type === 'story'
}
2024-01-17 14:07:30 +08:00
2024-01-25 22:50:17 +08:00
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>`
}
2024-01-17 14:07:30 +08:00
var html = `<!DOCTYPE html>`
if (theme.style.prefers_theme === 'auto') {
html += `<html lang="${page.lang}">`
} else {
html += `<html lang="${page.lang}" data-theme="${theme.style.prefers_theme}">`
}
2024-01-17 14:07:30 +08:00
html += partial('_partial/head')
html += `<body>`
2024-01-25 22:50:17 +08:00
html += site_background
2024-01-17 14:07:30 +08:00
html += partial('_partial/cover/index')
2024-02-12 23:07:56 +08:00
html += `<div class="l_body s:aa ${page_type} ${article_type}" id="start" layout="${page.layout}" ${indent ? 'text-indent' : ''}>`
2024-01-17 14:07:30 +08:00
html += `<aside class="l_left">`
2024-02-04 21:09:44 +08:00
html += `<div class="leftbar-container${theme.style.leftbar?.blur ? ' leftbar-blur' : ''}">`
2024-02-05 10:03:55 +08:00
html += partial('_partial/sidebar/index_leftbar')
2024-01-17 14:07:30 +08:00
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')
2024-02-05 18:01:50 +08:00
html += `<div class="main-mask" onclick="sidebar.dismiss()"></div>`
2024-01-17 14:07:30 +08:00
html += `</div>`
2024-02-05 10:03:55 +08:00
html += `<aside class="l_right">`
html += partial('_partial/sidebar/index_rightbar')
html += `</aside>`
2024-02-05 18:01:50 +08:00
html += partial('_partial/menubtn')
2024-01-17 14:07:30 +08:00
html += `</div>`
html += `<div class="scripts">`
2024-02-12 23:07:56 +08:00
html += partial('_partial/scripts')
2024-01-17 14:07:30 +08:00
html += `</div>`
html += `</body>`
html += `</html>`
%>
<%- html %>