Refactor layout

This commit is contained in:
Mimi 2020-08-06 21:34:53 +08:00
parent 4f192213b3
commit f76c0d8a97
12 changed files with 41 additions and 36 deletions

View File

@ -612,7 +612,7 @@ valine:
avatar: mm # Gravatar style avatar: mm # Gravatar style
meta: [] # Custom comment header: [nick, mail, link] meta: [] # Custom comment header: [nick, mail, link]
pageSize: 10 # Pagination size pageSize: 10 # Pagination size
language: # Language, available values: en, zh-cn lang: # Language, available values: en, zh-cn
visitor: false # Article reading statistic visitor: false # Article reading statistic
comment_count: true # If false, comment count will only be displayed in post page, not in home page 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 recordIP: false # Whether to record the commenter IP

View 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>

View File

@ -0,0 +1,6 @@
<div class="event-list">
</div>
<script{{ pjax }}>
CONFIG.calendar = {{ theme.calendar | safedump }};
</script>
{{- next_js('schedule.js', true) }}

View 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>

View File

@ -5,8 +5,9 @@
{{- next_js('motion.js') }} {{- next_js('motion.js') }}
{%- endif %} {%- endif %}
{%- set scheme_script = 'schemes/' + theme.scheme | lower + '.njk' %} {%- if theme.scheme === 'Muse' or theme.scheme === 'Mist' %}
{% include scheme_script %} {{- next_js('schemes/muse.js') }}
{%- endif %}
{{- next_js('next-boot.js') }} {{- next_js('next-boot.js') }}
{%- if theme.bookmark.enable %} {%- if theme.bookmark.enable %}

View File

@ -1,4 +0,0 @@
<script{{ pjax }}>
CONFIG.calendar = {{ theme.calendar | safedump }};
</script>
{{- next_js('schedule.js', true) }}

View File

@ -1 +0,0 @@
{{- next_js('schemes/muse.js') }}

View File

@ -1 +0,0 @@
{{- next_js('schemes/muse.js') }}

View File

@ -29,35 +29,11 @@
{#################} {#################}
<div class="post-body{%- if page.direction and page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}"> <div class="post-body{%- if page.direction and page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}">
{%- if page.type === 'tags' %} {%- if page.type === 'tags' %}
<div class="tag-cloud"> {% include '_partials/page/tags.njk' %}
<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>
{% elif page.type === 'categories' %} {% elif page.type === 'categories' %}
<div class="category-all-page"> {% include '_partials/page/categories.njk' %}
<div class="category-all-title">
{{ _p('counter.categories', site.categories.length) }}
</div>
<div class="category-all">
{{ list_categories() }}
</div>
</div>
{% elif page.type === 'schedule' %} {% elif page.type === 'schedule' %}
<div class="event-list"> {% include '_partials/page/schedule.njk' %}
</div>
{% include '_scripts/pages/schedule.njk' %}
{% else %} {% else %}
{{ page.content }} {{ page.content }}
{%- endif %} {%- endif %}

View File

@ -6,6 +6,10 @@ hexo.extend.filter.register('after_generate', () => {
const theme = hexo.theme.config; const theme = hexo.theme.config;
if (!theme.minify) return; if (!theme.minify) return;
if (!hexo.locals.get('pages').some(page => page.type === 'schedule')) {
hexo.route.remove('js/schedule.js');
}
if (!theme.bookmark.enable) { if (!theme.bookmark.enable) {
hexo.route.remove('js/bookmark.js'); hexo.route.remove('js/bookmark.js');
} }