mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Refactor layout
This commit is contained in:
parent
4f192213b3
commit
f76c0d8a97
@ -612,7 +612,7 @@ valine:
|
||||
avatar: mm # Gravatar style
|
||||
meta: [] # Custom comment header: [nick, mail, link]
|
||||
pageSize: 10 # Pagination size
|
||||
language: # Language, available values: en, zh-cn
|
||||
lang: # Language, available values: en, zh-cn
|
||||
visitor: false # Article reading statistic
|
||||
comment_count: true # If false, comment count will only be displayed in post page, not in home page
|
||||
recordIP: false # Whether to record the commenter IP
|
||||
|
||||
8
layout/_partials/page/categories.njk
Normal file
8
layout/_partials/page/categories.njk
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="category-all-page">
|
||||
<div class="category-all-title">
|
||||
{{ _p('counter.categories', site.categories.length) }}
|
||||
</div>
|
||||
<div class="category-all">
|
||||
{{ list_categories() }}
|
||||
</div>
|
||||
</div>
|
||||
6
layout/_partials/page/schedule.njk
Normal file
6
layout/_partials/page/schedule.njk
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="event-list">
|
||||
</div>
|
||||
<script{{ pjax }}>
|
||||
CONFIG.calendar = {{ theme.calendar | safedump }};
|
||||
</script>
|
||||
{{- next_js('schedule.js', true) }}
|
||||
16
layout/_partials/page/tags.njk
Normal file
16
layout/_partials/page/tags.njk
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="tag-cloud">
|
||||
<div class="tag-cloud-title">
|
||||
{{ _p('counter.tag_cloud', site.tags.length) }}
|
||||
</div>
|
||||
<div class="tag-cloud-tags">
|
||||
{{ tagcloud({
|
||||
min_font: theme.tagcloud.min,
|
||||
max_font: theme.tagcloud.max,
|
||||
amount : theme.tagcloud.amount,
|
||||
orderby : theme.tagcloud.orderby,
|
||||
order : theme.tagcloud.order,
|
||||
class : 'tag-cloud'
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
@ -5,8 +5,9 @@
|
||||
{{- next_js('motion.js') }}
|
||||
{%- endif %}
|
||||
|
||||
{%- set scheme_script = 'schemes/' + theme.scheme | lower + '.njk' %}
|
||||
{% include scheme_script %}
|
||||
{%- if theme.scheme === 'Muse' or theme.scheme === 'Mist' %}
|
||||
{{- next_js('schemes/muse.js') }}
|
||||
{%- endif %}
|
||||
|
||||
{{- next_js('next-boot.js') }}
|
||||
{%- if theme.bookmark.enable %}
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
<script{{ pjax }}>
|
||||
CONFIG.calendar = {{ theme.calendar | safedump }};
|
||||
</script>
|
||||
{{- next_js('schedule.js', true) }}
|
||||
@ -1 +0,0 @@
|
||||
{{- next_js('schemes/muse.js') }}
|
||||
@ -1 +0,0 @@
|
||||
{{- next_js('schemes/muse.js') }}
|
||||
@ -29,35 +29,11 @@
|
||||
{#################}
|
||||
<div class="post-body{%- if page.direction and page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}">
|
||||
{%- if page.type === 'tags' %}
|
||||
<div class="tag-cloud">
|
||||
<div class="tag-cloud-title">
|
||||
{{ _p('counter.tag_cloud', site.tags.length) }}
|
||||
</div>
|
||||
<div class="tag-cloud-tags">
|
||||
{{ tagcloud({
|
||||
min_font: theme.tagcloud.min,
|
||||
max_font: theme.tagcloud.max,
|
||||
amount : theme.tagcloud.amount,
|
||||
orderby : theme.tagcloud.orderby,
|
||||
order : theme.tagcloud.order,
|
||||
class : 'tag-cloud'
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
{% include '_partials/page/tags.njk' %}
|
||||
{% elif page.type === 'categories' %}
|
||||
<div class="category-all-page">
|
||||
<div class="category-all-title">
|
||||
{{ _p('counter.categories', site.categories.length) }}
|
||||
</div>
|
||||
<div class="category-all">
|
||||
{{ list_categories() }}
|
||||
</div>
|
||||
</div>
|
||||
{% include '_partials/page/categories.njk' %}
|
||||
{% elif page.type === 'schedule' %}
|
||||
<div class="event-list">
|
||||
</div>
|
||||
{% include '_scripts/pages/schedule.njk' %}
|
||||
{% include '_partials/page/schedule.njk' %}
|
||||
{% else %}
|
||||
{{ page.content }}
|
||||
{%- endif %}
|
||||
|
||||
@ -6,6 +6,10 @@ hexo.extend.filter.register('after_generate', () => {
|
||||
const theme = hexo.theme.config;
|
||||
if (!theme.minify) return;
|
||||
|
||||
if (!hexo.locals.get('pages').some(page => page.type === 'schedule')) {
|
||||
hexo.route.remove('js/schedule.js');
|
||||
}
|
||||
|
||||
if (!theme.bookmark.enable) {
|
||||
hexo.route.remove('js/bookmark.js');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user