cmd: support data file as theme config

This commit is contained in:
thisLight 2021-08-30 13:41:40 +08:00
parent e6076309bb
commit e7fb4f86bd
4 changed files with 29 additions and 10 deletions

13
source/_data/theme.yaml Normal file
View file

@ -0,0 +1,13 @@
copyright_addtional: ""
copyright_year_string: "2020-2021"
theme_self_claim: true
about_this_blog: 这里是Rubicon's Rubicon。我在无界之点的偏安之地。
my_mastodon: "https://mastodon.social/@thislight"
footer_links:
GitHub: "https://github.com/thislight"
GitLab: "https://gitlab.com/thislight"

View file

@ -69,21 +69,21 @@
<footer class="page-footer light-blue darken-4"> <footer class="page-footer light-blue darken-4">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
{% if theme.about_this_blog %} {% if site.data.theme.about_this_blog %}
<div class="col s12 m4"> <div class="col s12 m4">
<h5 class="white-text">About {{config.title}}</h5> <h5 class="white-text">About {{config.title}}</h5>
<p>{{theme.about_this_blog}}</p> <p>{{site.data.theme.about_this_blog}}</p>
</div> </div>
{% endif %} {% endif %}
{% if theme.footer_links %} {% if site.data.theme.footer_links %}
<div class="col s6 m4"> <div class="col s6 m4">
<h5 class="white-text"> Links </h5> <h5 class="white-text"> Links </h5>
<ul> <ul>
{% for name in Object.keys(theme.footer_links) %} {% for name in Object.keys(site.data.theme.footer_links) %}
<li><a class="grey-text text-lighten-3" href="{{theme.footer_links[name]}}">{{name}}</a></li> <li><a class="grey-text text-lighten-3" href="{{site.data.theme.footer_links[name]}}">{{name}}</a></li>
{% endfor %} {% endfor %}
{% if theme.my_mastodon %} {% if theme.my_mastodon %}
<li><a class="grey-text text-lighten-3" rel="me" href="{{theme.my_mastodon}}">My Mastodon</a></li> <li><a class="grey-text text-lighten-3" rel="me" href="{{site.data.theme.my_mastodon}}">My Mastodon</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@ -97,7 +97,7 @@
</div> </div>
<div class="footer-copyright"> <div class="footer-copyright">
<div class="container truncate"> <div class="container truncate">
© Copyright {{ theme.copyright_year_string }} {{ config.author }}. {{ theme.copyright_addtional }} © Copyright {{ site.data.theme.copyright_year_string }} {{ config.author }}. {{ site.data.theme.copyright_addtional }}
</div> </div>
</div> </div>
</footer> </footer>

View file

@ -67,8 +67,8 @@
{% endmacro %} {% endmacro %}
{% macro TagPanel(tags) %} {% macro TagPanel(tags) %}
<div class="card-panel" style="padding-top: 12px;"> <div class="card-panel" style="padding-top: 12px; padding-bottom: 12px;">
<h5>All Tags</h5> <span class="chip transparent">Tags</span>
{% for tag in tags %} {% for tag in tags %}
<a href="{{ url_for(tag.path)}}"><div class="chip"> <a href="{{ url_for(tag.path)}}"><div class="chip">
{{tag.name}} {{tag.name}}
@ -83,7 +83,7 @@
<div class="row"> <div class="row">
<div class="col m8 l9"> <div class="col m8 l9">
{% if page.current == 1 %} {% if page.current == 1 %}
{{ MeCard(config.author, config.email, theme.me_description) }} {{ MeCard(config.author, config.email, config.description) }}
{% endif %} {% endif %}
{% if page.posts.length > 0 %} {% if page.posts.length > 0 %}
{{ PostList(page.posts.toArray()) }} {{ PostList(page.posts.toArray()) }}
@ -99,3 +99,7 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block add_head %}
<link rel="stylesheet" href="/css/index.css">
{% endblock %}

View file

@ -0,0 +1,2 @@
.post-item img
max-height: 300px