update theme
This commit is contained in:
parent
57ed60df81
commit
4bcac944b3
27 changed files with 23899 additions and 1 deletions
73
themes/cmd/layout/archive.swig
Normal file
73
themes/cmd/layout/archive.swig
Normal file
|
@ -0,0 +1,73 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% 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() %}
|
||||
<div id="archive">
|
||||
<h1>Archives</h1>
|
||||
{% if theme.atom %}
|
||||
<p>
|
||||
The feed is available via
|
||||
<a href="{{ theme.atom }}">atom</a>.
|
||||
</p>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
{% if config.atom %}
|
||||
<p>
|
||||
The feed is available via
|
||||
<a href="{{ config.atom }}">atom</a>.
|
||||
</p>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<aside>
|
||||
<h2>Categories</h2>
|
||||
{% if categoriesList %}
|
||||
{% autoescape false %}{{ categoriesList }}{% endautoescape %}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
||||
</aside>
|
||||
<br>
|
||||
|
||||
<aside>
|
||||
<h2>Tags</h2>
|
||||
{% if tagsList %}
|
||||
{% autoescape false %}{{ tagsList }}{% endautoescape %}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
||||
</aside>
|
||||
<br>
|
||||
|
||||
<aside>
|
||||
<h2>Archives</h2>
|
||||
{% if archivesList %}
|
||||
{% autoescape false %}{{ archivesList }}{% endautoescape %}
|
||||
{% else %}
|
||||
<p>None.</p>
|
||||
{% endif %}
|
||||
</aside>
|
||||
</div>
|
||||
{% else %}
|
||||
<h1>{{ page.month + '/' + page.year }}</h1>
|
||||
{% for postItem in page.posts.toArray() %}
|
||||
<div class="archive-item">
|
||||
<a href="{{ url_for(postItem.path) }}">
|
||||
{{ postItem.title }}
|
||||
</a>
|
||||
<time datetime="{{ date_xml(postItem.date) }}">
|
||||
{{ date(postItem.date) }}
|
||||
</time>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div id="paginator">
|
||||
{{ paginator() }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
21
themes/cmd/layout/category.swig
Normal file
21
themes/cmd/layout/category.swig
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% block body %}
|
||||
<div id="category">
|
||||
<h1>{{ page.category }}</h1>
|
||||
{% for postItem in page.posts.toArray() %}
|
||||
<div class="category-item">
|
||||
<a href="{{ url_for(postItem.path) }}">
|
||||
{{ postItem.title }}
|
||||
</a>
|
||||
<time datetime="{{ date_xml(postItem.date) }}">
|
||||
{{ date(postItem.date) }}
|
||||
</time>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div id="paginator">
|
||||
{{ paginator() }}
|
||||
</div>
|
||||
{% endblock %}
|
109
themes/cmd/layout/includes/layout.swig
Normal file
109
themes/cmd/layout/includes/layout.swig
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
{% 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 }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% block add_head %}{% endblock %}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<ul id="nav-mobile" class="sidenav">
|
||||
{% for key in Object.keys(theme.menu) %}
|
||||
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
</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">
|
||||
{% for key in Object.keys(theme.menu) %}
|
||||
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
|
||||
{% endfor %}
|
||||
</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 theme.about_this_blog %}
|
||||
<div class="col s12 m4">
|
||||
<h5 class="white-text">About {{config.title}}</h5>
|
||||
<p>{{theme.about_this_blog}}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if theme.footer_links %}
|
||||
<div class="col s6 m4">
|
||||
<h5 class="white-text"> Links </h5>
|
||||
<ul>
|
||||
{% for name in Object.keys(theme.footer_links) %}
|
||||
<li><a class="grey-text text-lighten-3" href="{{theme.footer_links[name]}}">{{name}}</a></li>
|
||||
{% endfor %}
|
||||
</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 {{ theme.copyright_year_string }} {{ config.author }}. {{ 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>
|
14
themes/cmd/layout/includes/recent-posts.swig
Normal file
14
themes/cmd/layout/includes/recent-posts.swig
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
{% if page.posts.length > 0 %}
|
||||
<div id="recent-posts">
|
||||
<h1>All Posts</h1>
|
||||
{% for postItem in page.posts.toArray() %}
|
||||
<div class="recent-post-item">
|
||||
<a href="{{ url_for(postItem.path) }}">{{ postItem.title }}</a>
|
||||
<time datetime="{{ postItem.date.toJSON() }}">
|
||||
{{ date(postItem.date) }}
|
||||
</time>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
110
themes/cmd/layout/index.swig
Normal file
110
themes/cmd/layout/index.swig
Normal file
|
@ -0,0 +1,110 @@
|
|||
{% 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>{{ 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>{{ 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">
|
||||
<img class="circle responsive-img" src="{{ gravatar(email) }}" async />
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col" style="padding: 12px">
|
||||
<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">
|
||||
<h5>All Tags</h5>
|
||||
{% for tag in tags %}
|
||||
<a href="{{ url_for(tag.path)}}"><div class="chip">
|
||||
{{tag.name}}
|
||||
</div></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro Paginiation() %}
|
||||
<ul class="pagination">
|
||||
<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 %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col m8 l9">
|
||||
{% if page.current == 1 %}
|
||||
{{ MeCard(config.author, config.email, theme.me_description) }}
|
||||
{% endif %}
|
||||
{% if page.posts.length > 0 %}
|
||||
{{ PostList(page.posts.toArray()) }}
|
||||
{% else %}
|
||||
<span>No Post Here...</span>
|
||||
{% endif %}
|
||||
<div class="center">
|
||||
{{ Paginiation() }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col m4 l3 hide-on-small-only">
|
||||
{{ TagPanel(site.tags) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
12
themes/cmd/layout/page.swig
Normal file
12
themes/cmd/layout/page.swig
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% block body %}
|
||||
<article id="page">
|
||||
<h1>{{ page.title }}</h1>
|
||||
{% autoescape false %}{{page.content }}{% endautoescape %}
|
||||
</article>
|
||||
|
||||
<div id="paginator">
|
||||
{{ paginator() }}
|
||||
</div>
|
||||
{% endblock %}
|
37
themes/cmd/layout/post.swig
Normal file
37
themes/cmd/layout/post.swig
Normal file
|
@ -0,0 +1,37 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% macro Gallery(photos) %}
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{% set i = 0 %}
|
||||
{% for p in photos %}
|
||||
{% set i = i + 1 %}
|
||||
<img onerror="M.toast({ html: 'Some photos could not be showed at the moment, please try again later.' });" src="{{p}}" data-caption="{{i}}" class="responsive-img materialboxed gallery-img" async />
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% block body %}
|
||||
<article id="post">
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<span class="card-title">{{ page.title }}</span>
|
||||
<div class="row">
|
||||
<div class="col" style="padding-left:0;"><span class="mdi mdi-account">{{config.author}}</span></div>
|
||||
<div class="col"><span class="mdi mdi-clock">{{date(page.date, 'YYYY/M/D')}}</span></div>
|
||||
</div>
|
||||
{% if page.photos && page.photos.length > 0%}
|
||||
{{Gallery(page.photos)}}
|
||||
{% endif %}
|
||||
<div class="flow-text">
|
||||
{% autoescape false %}{{ page.content }}{% endautoescape %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<div id="paginator">
|
||||
{{ paginator() }}
|
||||
</div>
|
||||
{% endblock %}
|
21
themes/cmd/layout/tag.swig
Normal file
21
themes/cmd/layout/tag.swig
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'includes/layout.swig' %}
|
||||
|
||||
{% block body %}
|
||||
<div id="tag">
|
||||
<h1>{{ page.tag }}</h1>
|
||||
{% for article in page.posts.toArray() %}
|
||||
<div class="tag-item">
|
||||
<a href="{{ url_for(article.path) }}">
|
||||
{{ article.title }}
|
||||
</a>
|
||||
<time datetime="{{ date_xml(article.date) }}">
|
||||
{{ date(article.date) }}
|
||||
</time>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div id="paginator">
|
||||
{{ paginator() }}
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue