move cmd to nunjucks & update hexo to 6.0.0
Other changes: * minor fix to the display for code blocks * remove floating when hover on cards * replace the list of tags and categories to the index page one * small change on the title of tags' and categories' pages
This commit is contained in:
parent
4abb723445
commit
781759d545
23 changed files with 440 additions and 547 deletions
|
@ -24,26 +24,10 @@ copyright_year_string: "2020-2021"
|
|||
|
||||
theme_self_claim: true
|
||||
|
||||
about_this_blog: This blog is created with Classical Material Desgin theme, which is a original taste of Material Design for hexo.
|
||||
about_this_blog: This blog is created with Classical Material Desgin, which try to keep the original taste of Material Design for hexo.
|
||||
|
||||
my_mastodon: https://mastodon.example.com/@example
|
||||
|
||||
footer_links:
|
||||
Link 1: "https://example.org"
|
||||
Link 2: "https://example.com"
|
||||
|
||||
site_rss:
|
||||
atom: /atom.xml
|
||||
rss: /rss.xml
|
||||
|
||||
topic_rss:
|
||||
tag:
|
||||
prefix: "/feeds/by-tag/"
|
||||
atom_suffix: /atom.xml
|
||||
rss_suffix: /rss.xml
|
||||
name_lowercase: true
|
||||
category:
|
||||
prefix: /feeds/by-category/
|
||||
atom_suffix: /atom.xml
|
||||
rss_suffix: /rss.xml
|
||||
name_lowercase: true
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
{% extends 'includes/layout.njk' %}
|
||||
|
||||
{% block body %}
|
||||
{% set categoriesList = list_categories({ show_count: false }) %}
|
||||
{% set tagsList = list_tags({ show_count: false }) %}
|
||||
{% set archivesList = list_archives({ show_count: false }) %}
|
||||
|
||||
{% if !is_year() %}
|
||||
{% if not is_year() %}
|
||||
<div id="archive">
|
||||
<h1>Archives</h1>
|
||||
{% if theme.atom %}
|
||||
|
@ -27,7 +27,7 @@
|
|||
<aside>
|
||||
<h2>Categories</h2>
|
||||
{% if categoriesList %}
|
||||
{% autoescape false %}{{ categoriesList }}{% endautoescape %}
|
||||
{{ categoriesList | safe}}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
||||
|
@ -37,7 +37,7 @@
|
|||
<aside>
|
||||
<h2>Tags</h2>
|
||||
{% if tagsList %}
|
||||
{% autoescape false %}{{ tagsList }}{% endautoescape %}
|
||||
{{ tagsList | safe }}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
||||
|
@ -47,7 +47,7 @@
|
|||
<aside>
|
||||
<h2>Archives</h2>
|
||||
{% if archivesList %}
|
||||
{% autoescape false %}{{ archivesList }}{% endautoescape %}
|
||||
{{ archivesList | safe }}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
13
themes/cmd/layout/category.njk
Normal file
13
themes/cmd/layout/category.njk
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends 'includes/layout.njk' %}
|
||||
|
||||
{% import "includes/paginator.njk" as P with context%}
|
||||
{% import "includes/postlist.njk" as PostList with context %}
|
||||
|
||||
{% block body %}
|
||||
<h2 style="margin-left: 1rem">Category::{{page.category}}</h2>
|
||||
{{ PostList.PostList(page.posts.toArray()) }}
|
||||
|
||||
<div id="center">
|
||||
{{ P.Paginiation() }}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,55 +0,0 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% import "includes/paginator.swig" as P %}
|
||||
{% import "includes/tags.swig" as T %}
|
||||
|
||||
{% block body %}
|
||||
<div id="category">
|
||||
<div class="card z-depth-0">
|
||||
<h2 style="margin-left: 1rem; margin-bottom: 0;">{{page.category}}<i class="mdi mdi-tag" style="font-size: 2rem; color: #ee6e73;"></i></h2>
|
||||
{% if site.data.theme.topic_rss and site.data.theme.topic_rss.category %}
|
||||
{% set category_rss = site.data.theme.topic_rss.category %}
|
||||
{% if category_rss.name_lowercase %}
|
||||
{% set rss_name = page.category.toLowerCase() %}
|
||||
{% else %}
|
||||
{% set rss_name = page.category %}
|
||||
{% endif %}
|
||||
<div class="card-action">
|
||||
{% if category_rss.atom_suffix %}
|
||||
<a href="{{ full_url_for(category_rss.prefix + rss_name + category_rss.atom_suffix) }}">Feed (Atom)</a>
|
||||
{% endif %}
|
||||
{% if category_rss.rss_suffix %}
|
||||
<a href="{{ full_url_for(category_rss.prefix + rss_name + category_rss.rss_suffix) }}">Feed (RSS)</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="collapsible popout">
|
||||
{% for article in page.posts.toArray() %}
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<div class="row" style="margin: 0;">
|
||||
<div class="row" style="margin-left: 4px; margin-bottom: 0.5rem;"><div class="col s12"><h3 style="font-size: 1.2rem; margin: 0; margin-top: 8px;">{{article.title}}</h3></div></div>
|
||||
<div class="row" style="margin-left: 0; margin-bottom: 0;"><div class="col s12">{{ T.PostTags(article) }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapsible-body small-padding">
|
||||
<div style="padding-left: 1rem">
|
||||
<div class="mdi mdi-clock" style="padding-bottom: 8px">{{ date(article.date) }}</div>
|
||||
</div>
|
||||
<div class="entry">{{article.excerpt}}</div>
|
||||
<div class="card z-depth-0">
|
||||
<div class="card-action" style="padding-bottom: 0; padding-left: 14px;">
|
||||
<a href="{% if article.link %}{{article.link}}{% else %}{{url_for(article.path)}}{% endif %}">Go To "{{article.title}}"</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div id="center">
|
||||
{{ P.Paginiation() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
24
themes/cmd/layout/includes/cards.njk
Normal file
24
themes/cmd/layout/includes/cards.njk
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
{% macro Me(name, email, description) %}
|
||||
<div class="card">
|
||||
<div class="row" style="margin-bottom: 0">
|
||||
<div class="col" style="padding: 12px; padding-left: 20px;">
|
||||
<img class="circle responsive-img" src="{{ gravatar(email if email else 'example@foo.bar') }}"/>
|
||||
</div>
|
||||
<div class="col" style="padding-top: 12px; padding-left: 12px">
|
||||
{% if name %}
|
||||
<div class="row" style="margin-bottom: 0">
|
||||
<h6>{{ name }}</h6>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row" style="margin-bottom: 0">
|
||||
<p>
|
||||
{% if description %}
|
||||
{{ description }}{% else %}Nothing to say.{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
132
themes/cmd/layout/includes/layout.njk
Normal file
132
themes/cmd/layout/includes/layout.njk
Normal file
|
@ -0,0 +1,132 @@
|
|||
{% set pageTitle = page.title or config.subtitle or '' %}
|
||||
|
||||
{% if is_archive() %}
|
||||
{% set pageTitle = 'Archives' %}
|
||||
{% elif is_tag() %}
|
||||
{% set pageTitle = 'Tag: ' + page.tag %}
|
||||
{% elif is_category() %}
|
||||
{% set pageTitle = 'Category: ' + page.category %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_month() %}
|
||||
{% set pageTitle = pageTitle + ': ' + page.month + '/' + page.year %}
|
||||
{% elif is_year() %}
|
||||
{% set pageTitle = pageTitle + ': ' + page.year %}
|
||||
{% endif %}
|
||||
|
||||
{% if pageTitle == '' %}
|
||||
{% set pageTitle = config.title %}
|
||||
{% endif %}
|
||||
|
||||
<!doctype html>
|
||||
<html lang="{{ config.language }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ pageTitle }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
{% if theme.stylesheets !== undefined and theme.stylesheets.length > 0 %}
|
||||
{# stylesheet list from _config.yml #}
|
||||
{% for url in theme.stylesheets %}
|
||||
<link rel="stylesheet" href="{{ url }}" media="print" onload="this.media='all'; this.onload=null;">
|
||||
<noscript><link rel="stylesheet" href="{{ url }}"></noscript>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{url_for('/materialize/css/materialize.css')}}"/>
|
||||
{% block add_head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul id="nav-mobile" class="sidenav">
|
||||
{% if site.data.theme.menu %}
|
||||
{% for key, path in site.data.theme.menu %}
|
||||
<li>
|
||||
<a href="{{ path }}">{{ key }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key, path in theme.menu %}
|
||||
<li>
|
||||
<a href="{{ path }}">{{ key }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
<nav class="light-blue lighten-1" role="navigation">
|
||||
<a href="#" data-target="nav-mobile" class="sidenav-trigger">
|
||||
<div class="mdi mdi-menu"></div>
|
||||
</a>
|
||||
<div class="nav-wrapper">
|
||||
<ul class="right hide-on-med-and-down">
|
||||
{% if site.data.theme.menu %}
|
||||
{% for key, path in site.data.theme.menu %}
|
||||
<li>
|
||||
<a href="{{ path }}">{{ key }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key, path in theme.menu %}
|
||||
<li>
|
||||
<a href="{{ path }}">{{ key }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main id="content" class="container xscontainer">
|
||||
{% block body %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="page-footer light-blue darken-4">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% if site.data.theme.about_this_blog %}
|
||||
<div class="col s12 m4">
|
||||
<h5 class="white-text">About {{ config.title }}</h5>
|
||||
<p>{{ site.data.theme.about_this_blog }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if site.data.theme.footer_links %}
|
||||
<div class="col s6 m4">
|
||||
<h5 class="white-text">
|
||||
Links
|
||||
</h5>
|
||||
<ul>
|
||||
{% for name, link in site.data.theme.footer_links %}
|
||||
<li>
|
||||
<a class="grey-text text-lighten-3" href="{{ link }}">{{ name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if theme.my_mastodon %}
|
||||
<li>
|
||||
<a class="grey-text text-lighten-3" rel="me" href="{{ site.data.theme.my_mastodon }}">My Mastodon</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if theme.theme_self_claim %}
|
||||
<div class="col s6 m4">
|
||||
<p>This blog uses Classical Material Design theme.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-copyright">
|
||||
<div class="container truncate">
|
||||
© Copyright {{ site.data.theme.copyright_year_string }}
|
||||
{{ config.author }}.
|
||||
{{ site.data.theme.copyright_addtional }}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{% if theme.scripts !== undefined and theme.scripts.length > 0 %}
|
||||
{# scripts list from config.yml #}
|
||||
{% for url in theme.scripts %}
|
||||
<script src="{{ url }}"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% block add_scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -1,135 +0,0 @@
|
|||
|
||||
{% set pageTitle = page.title || config.subtitle || '' %}
|
||||
|
||||
{% if is_archive() %}
|
||||
{% set pageTitle = 'Archives' %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_tag() %}
|
||||
{% set pageTitle = 'Tag: ' + page.tag %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_category() %}
|
||||
{% set pageTitle = 'Category: ' + page.category %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_month() %}
|
||||
{% set pageTitle = pageTitle + ': ' + page.month + '/' + page.year %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_year() %}
|
||||
{% set pageTitle = pageTitle + ': ' + page.year %}
|
||||
{% endif %}
|
||||
|
||||
{% if pageTitle == '' %}
|
||||
{% set pageTitle = config.title %}
|
||||
{% endif %}
|
||||
|
||||
<!doctype html>
|
||||
<html lang="{{ config.language }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ pageTitle }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
|
||||
{% if theme.stylesheets !== undefined && theme.stylesheets.length > 0 %}
|
||||
{# stylesheet list from _config.yml #}
|
||||
{% for url in theme.stylesheets %}
|
||||
<link rel="stylesheet" href="{{ url }}" media="print" onload="this.media='all'; this.onload=null;">
|
||||
<noscript><link rel="stylesheet" href="{{ url }}"></noscript>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="/materialize/css/materialize.css">
|
||||
|
||||
{% if site.data.theme.site_rss %}
|
||||
{% if site.data.theme.site_rss.rss %}
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ config.title }}" href="{{ full_url_for(site.data.theme.site_rss.rss) }}" />
|
||||
{% endif %}
|
||||
{% if site.data.theme.site_rss.atom %}
|
||||
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}" href="{{ full_url_for(site.data.theme.site_rss.atom) }}" />
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% block add_head %}{% endblock %}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<ul id="nav-mobile" class="sidenav">
|
||||
{% if site.data.theme.menu %}
|
||||
{% for key in Object.keys(site.data.theme.menu) %}
|
||||
<li><a href="{{ site.data.theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key in Object.keys(theme.menu) %}
|
||||
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
<nav class="light-blue lighten-1" role="navigation">
|
||||
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><div class="mdi mdi-menu"></div></a>
|
||||
<div class="nav-wrapper">
|
||||
<ul class="right hide-on-med-and-down">
|
||||
{% if site.data.theme.menu %}
|
||||
{% for key in Object.keys(site.data.theme.menu) %}
|
||||
<li><a href="{{ site.data.theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key in Object.keys(theme.menu) %}
|
||||
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main id="content" class="container xscontainer">
|
||||
{% block body %}{% endblock %}
|
||||
</main>
|
||||
|
||||
|
||||
<footer class="page-footer light-blue darken-4">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% if site.data.theme.about_this_blog %}
|
||||
<div class="col s12 m4">
|
||||
<h5 class="white-text">About {{config.title}}</h5>
|
||||
<p>{{site.data.theme.about_this_blog}}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if site.data.theme.footer_links %}
|
||||
<div class="col s6 m4">
|
||||
<h5 class="white-text"> Links </h5>
|
||||
<ul>
|
||||
{% for name in Object.keys(site.data.theme.footer_links) %}
|
||||
<li><a class="grey-text text-lighten-3" href="{{site.data.theme.footer_links[name]}}">{{name}}</a></li>
|
||||
{% endfor %}
|
||||
{% if theme.my_mastodon %}
|
||||
<li><a class="grey-text text-lighten-3" rel="me" href="{{site.data.theme.my_mastodon}}">My Mastodon</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if theme.theme_self_claim %}
|
||||
<div class="col s6 m4">
|
||||
<p>This blog uses Classical Material Design theme.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-copyright">
|
||||
<div class="container truncate">
|
||||
© Copyright {{ site.data.theme.copyright_year_string }} {{ config.author }}. {{ site.data.theme.copyright_addtional }}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{% if theme.scripts !== undefined && theme.scripts.length > 0 %}
|
||||
{# scripts list from config.yml #}
|
||||
{% for url in theme.scripts %}
|
||||
<script src="{{ url }}"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% block add_scripts %}{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
23
themes/cmd/layout/includes/paginator.njk
Normal file
23
themes/cmd/layout/includes/paginator.njk
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% macro Paginiation() %}
|
||||
<ul class="pagination center">
|
||||
{% if page.prev %}
|
||||
<li class="waves-effect">
|
||||
<a href="{{ page.prev_link }}">
|
||||
<i class="mdi mdi-chevron-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for n in range(1, page.total, 1) %}
|
||||
<li class="{{ 'active' if page.current == n else 'waves-effect' }}">
|
||||
<a href="{{ url_for('page/'+n+'/') }}">{{ n }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if page.next %}
|
||||
<li class="waves-effect">
|
||||
<a href="{{ page.next_link }}">
|
||||
<i class="mdi mdi-chevron-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endmacro %}
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
{% macro Paginiation() %}
|
||||
<ul class="pagination center">
|
||||
<li class="{% if page.current == 1 %}disabled{% else %}waves-effect{% endif %}"><a href="{% if (page.current-1) == 1 %}{{url_for('/')}}{% else %}{{ page.prev_link }}{% endif %}"><i class="mdi mdi-chevron-left"></i></a></li>
|
||||
<li class="{% if page.current == 1 %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('/') }}">1</a></li>
|
||||
{% for n in range(2, page.total, 1) %}
|
||||
<li class="{% if page.current == n %}active{% else %}waves-effect{% endif %}"><a href="{{ url_for('page/'+n+'/') }}">{{n}}</a></li>
|
||||
{% endfor %}
|
||||
<li class="{% if page.current == page.total %}disabled{% else %}waves-effect{% endif %}"><a href="{{ page.next_link }}"><i class="mdi mdi-chevron-right"></i></a></li>
|
||||
</ul>
|
||||
{% endmacro %}
|
43
themes/cmd/layout/includes/postlist.njk
Normal file
43
themes/cmd/layout/includes/postlist.njk
Normal file
|
@ -0,0 +1,43 @@
|
|||
|
||||
{%from 'includes/tags.njk' import PostTags with context%}
|
||||
|
||||
{% macro PostList(posts) %}
|
||||
<ul class="collection">
|
||||
{% for post in posts %}
|
||||
<li class="collection-item no-padding">
|
||||
<div class="card z-depth-0 card-small-margin">
|
||||
{% if post.photos and post.photos.length > 0 %}
|
||||
<a href="{{ url_for(post.path) }}">
|
||||
<div class="card-image">
|
||||
<img class="responsive-img" src="{{ post.photos[0] }}"/>
|
||||
<span class="card-title">{{ post.title }}</span>
|
||||
</div>
|
||||
</a>
|
||||
{% if (post.tags.length > 0) or post.excerpt != "" %}
|
||||
<div class="card-content">
|
||||
{{ PostTags(post) }}
|
||||
{% if post.excerpt != "" %}
|
||||
<p class="entry">{{ post.excerpt }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="card-content">
|
||||
<a href="{{ post.link if post.link else url_for(post.path) }}" {% if post.link %} target="_blank" {% endif %}>
|
||||
<span class="card-title">
|
||||
{% if (post.title != '' and post.title !== null and post.title !== undefined) %}
|
||||
{{ post.title }}
|
||||
{% else %}
|
||||
{{ post.path }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
<p class="entry">{{ post.excerpt }}</p>
|
||||
{{ PostTags(post) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
9
themes/cmd/layout/includes/tags.njk
Normal file
9
themes/cmd/layout/includes/tags.njk
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% macro PostTags(post) %}
|
||||
<div>
|
||||
{% for tag in post.tags.data %}
|
||||
<a href="{{ url_for(tag.path) }}"><div class="chip">
|
||||
{{tag.name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
|
@ -1,9 +0,0 @@
|
|||
{% macro PostTags(post) %}
|
||||
<div>
|
||||
{% for k in Object.keys(post.tags.data) %}
|
||||
<a href="{{ url_for(post.tags.data[k].path)}}"><div class="chip">
|
||||
{{post.tags.data[k].name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
41
themes/cmd/layout/index.njk
Normal file
41
themes/cmd/layout/index.njk
Normal file
|
@ -0,0 +1,41 @@
|
|||
{% extends 'includes/layout.njk' %}
|
||||
{% from "includes/paginator.njk" import Paginiation with context %}
|
||||
{% from "includes/postlist.njk" import PostList with context %}
|
||||
{% import "includes/cards.njk" as cards with context %}
|
||||
|
||||
{% macro TagPanel(tags) %}
|
||||
<div class="card-panel" style="padding-top: 12px; padding-bottom: 12px;">
|
||||
<span class="chip transparent">Tags</span>
|
||||
{% for tag in tags %}
|
||||
<a href="{{ url_for(tag.path) }}">
|
||||
<div class="chip">
|
||||
{{ tag.name }}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col m8 l9">
|
||||
{% if page.current == 1 %}
|
||||
{{ cards.Me(config.author, config.email, config.description) }}
|
||||
{% endif %}
|
||||
{% if page.posts.length > 0 %}
|
||||
{{ PostList(page.posts.toArray()) }}
|
||||
{% else %}
|
||||
<span>No Posts Here...</span>
|
||||
{% endif %}
|
||||
<div class="center">
|
||||
{{ Paginiation() }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col m4 l3 hide-on-small-only">
|
||||
{{ TagPanel(site.tags.data) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block add_head %}
|
||||
<link rel="stylesheet" href="/css/index.css"/>
|
||||
{% endblock %}
|
|
@ -1,105 +0,0 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% macro PostTags(post) %}
|
||||
<div>
|
||||
{% for k in Object.keys(post.tags.data) %}
|
||||
<a href="{{ url_for(post.tags.data[k].path)}}"><div class="chip">
|
||||
{{post.tags.data[k].name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro PostList(posts) %}
|
||||
<ul class="collection">
|
||||
{% for post in posts %}
|
||||
<li class="collection-item hoverable no-padding">
|
||||
<div class="card z-depth-0 card-small-margin">
|
||||
{% if post.photos && post.photos.length > 0 %}
|
||||
<div class="card-image">
|
||||
<img class="responsive-img" src="{{ post.photos[0] }}" />
|
||||
<span class="card-title">{{ post.title }}</span>
|
||||
</div>
|
||||
{% if (post.tags.length > 0) || post.excerpt != "" %}
|
||||
<div class="card-content">
|
||||
{{ PostTags(post) }}
|
||||
{% if post.excerpt != "" %}
|
||||
<p class="entry">{{ post.excerpt }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-action">
|
||||
<a href="{{ url_for(post.path) }}">Go to "{{post.title}}"</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card-content">
|
||||
<a href="{% if post.link %}{{ post.link }}{% else %}{{ url_for(post.path) }}{% endif %}" {%if post.link%}target="_blank"{%endif%}><span class="card-title">{% if (post.title != '' && post.title !== null && post.title !== undefined) %}{{ post.title }}{% else %}{{ post.path }}{% endif %}</span></a>
|
||||
<p class="entry">{{ post.excerpt }}</p>
|
||||
{{ PostTags(post) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro MeCard(name, email, description) %}
|
||||
<div class="card">
|
||||
<div class="row" style="margin-bottom: 0" >
|
||||
{% if email %}
|
||||
<div class="col" style="padding: 12px; padding-left: 20px;">
|
||||
<img class="circle responsive-img" src="{{ gravatar(email) }}" async />
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col" style="padding: 12px; padding-left: 20px;">
|
||||
<img class="circle responsive-img" src="{{ gravatar('example@foo.bar') }}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col" style="padding-top: 12px; padding-left: 12px">
|
||||
{% if name %}
|
||||
<div class="row" style="margin-bottom: 0"><h6>{{ name }}</h6></div>
|
||||
{% endif %}
|
||||
<div class="row" style="margin-bottom: 0"><p>{%if description %}{{description}}{% else %}Nothing to say.{%endif%}</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro TagPanel(tags) %}
|
||||
<div class="card-panel" style="padding-top: 12px; padding-bottom: 12px;">
|
||||
<span class="chip transparent">Tags</span>
|
||||
{% for tag in tags %}
|
||||
<a href="{{ url_for(tag.path)}}"><div class="chip">
|
||||
{{tag.name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% import "includes/paginator.swig" as P%}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col m8 l9">
|
||||
{% if page.current == 1 %}
|
||||
{{ MeCard(config.author, config.email, config.description) }}
|
||||
{% endif %}
|
||||
{% if page.posts.length > 0 %}
|
||||
{{ PostList(page.posts.toArray()) }}
|
||||
{% else %}
|
||||
<span>No Post Here...</span>
|
||||
{% endif %}
|
||||
<div class="center">
|
||||
{{ P.Paginiation() }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col m4 l3 hide-on-small-only">
|
||||
{{ TagPanel(site.tags) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block add_head %}
|
||||
<link rel="stylesheet" href="/css/index.css">
|
||||
{% endblock %}
|
|
@ -1,14 +1,6 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
{% extends 'includes/layout.njk' %}
|
||||
|
||||
{% macro PostTags(post) %}
|
||||
<div>
|
||||
{% for k in Object.keys(post.tags.data) %}
|
||||
<a href="{{ url_for(post.tags.data[k].path)}}"><div class="chip">
|
||||
{{post.tags.data[k].name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% from 'includes/tags.njk' import PostTags with context%}
|
||||
|
||||
{% macro Gallery(photos) %}
|
||||
<div class="row">
|
|
@ -1,14 +1,6 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
{% extends 'includes/layout.njk' %}
|
||||
|
||||
{% macro PostTags(post) %}
|
||||
<div>
|
||||
{% for k in Object.keys(post.tags.data) %}
|
||||
<a href="{{ url_for(post.tags.data[k].path)}}"><div class="chip">
|
||||
{{post.tags.data[k].name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% from 'includes/tags.njk' import PostTags with context%}
|
||||
|
||||
{% macro Gallery(photos) %}
|
||||
<div class="row">
|
||||
|
@ -32,11 +24,11 @@
|
|||
<div class="col"><span class="mdi mdi-clock">{{date(page.date, 'YYYY/M/D')}}</span></div>
|
||||
</div>
|
||||
{{ PostTags(page) }}
|
||||
{% if page.photos && page.photos.length > 0%}
|
||||
{% if page.photos and page.photos.length > 0 %}
|
||||
{{Gallery(page.photos)}}
|
||||
{% endif %}
|
||||
<div class="entry">
|
||||
{% autoescape false %}{{ page.content }}{% endautoescape %}
|
||||
{{ page.content | safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
13
themes/cmd/layout/tag.njk
Normal file
13
themes/cmd/layout/tag.njk
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends 'includes/layout.njk' %}
|
||||
|
||||
{% import "includes/paginator.njk" as P with context%}
|
||||
{% import "includes/postlist.njk" as PostList with context%}
|
||||
|
||||
{% block body %}
|
||||
<h2 style="margin-left: 1rem"><i class="mdi mdi-tag" style="font-size: 2rem;"></i>::{{page.tag}}</h2>
|
||||
{{ PostList.PostList(page.posts.toArray()) }}
|
||||
|
||||
<div id="center">
|
||||
{{ P.Paginiation() }}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,53 +0,0 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% import "includes/paginator.swig" as P %}
|
||||
{% import "includes/tags.swig" as T %}
|
||||
|
||||
{% block body %}
|
||||
<div class="card z-depth-0">
|
||||
<h2 style="margin-left: 1rem; margin-bottom: 0;">{{page.tag}}<i class="mdi mdi-tag" style="font-size: 2rem; color: #ee6e73;"></i></h2>
|
||||
{% if site.data.theme.topic_rss and site.data.theme.topic_rss.tag %}
|
||||
{% set tag_rss = site.data.theme.topic_rss.tag %}
|
||||
{% if tag_rss.name_lowercase %}
|
||||
{% set rss_name = page.tag.toLowerCase() %}
|
||||
{% else %}
|
||||
{% set rss_name = page.tag %}
|
||||
{% endif %}
|
||||
<div class="card-action">
|
||||
{% if tag_rss.atom_suffix %}
|
||||
<a href="{{ full_url_for(tag_rss.prefix + rss_name + tag_rss.atom_suffix) }}">Feed (Atom)</a>
|
||||
{% endif %}
|
||||
{% if tag_rss.rss_suffix %}
|
||||
<a href="{{ full_url_for(tag_rss.prefix + rss_name + tag_rss.rss_suffix) }}">Feed (RSS)</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<ul class="collapsible popout">
|
||||
{% for article in page.posts.toArray() %}
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<div class="row" style="margin: 0;">
|
||||
<div class="row" style="margin-left: 4px; margin-bottom: 0.5rem;"><div class="col s12"><h3 style="font-size: 1.2rem; margin: 0; margin-top: 8px;">{{article.title}}</h3></div></div>
|
||||
<div class="row" style="margin-left: 0; margin-bottom: 0;"><div class="col s12">{{ T.PostTags(article) }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapsible-body small-padding">
|
||||
<div style="padding-left: 1rem">
|
||||
<div class="mdi mdi-clock" style="padding-bottom: 8px">{{ date(article.date) }}</div>
|
||||
</div>
|
||||
<div class="entry">{{article.excerpt}}</div>
|
||||
<div class="card z-depth-0">
|
||||
<div class="card-action" style="padding-bottom: 0; padding-left: 14px;">
|
||||
<a href="{% if article.link %}{{article.link}}{% else %}{{url_for(article.path)}}{% endif %}">Go To "{{article.title}}"</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div id="center">
|
||||
{{ P.Paginiation() }}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
hexo.extend.helper.register("range", function(start, stop, step){
|
||||
return Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
|
||||
});
|
|
@ -31,4 +31,11 @@ main
|
|||
padding-bottom: 0 !important
|
||||
|
||||
.entry ul li
|
||||
list-style-type: square !important
|
||||
list-style-type: square !important
|
||||
|
||||
/* Override code block */
|
||||
figure.highlight > table > tbody > tr > td
|
||||
padding: 0
|
||||
|
||||
figure.highlight table tbody tr:last-child td
|
||||
padding-bottom: 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue