Skip to content

Commit

Permalink
Rewrite theme for halo.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Aug 23, 2019
1 parent 7326878 commit 9ff9910
Show file tree
Hide file tree
Showing 39 changed files with 288 additions and 229 deletions.
10 changes: 10 additions & 0 deletions index.ftl
@@ -0,0 +1,10 @@
<#include "layout/layout.ftl">
<#include "layout/common/article.ftl">
<@layout title="${options.blog_title!}" keywords="${options.seo_keywords!}" description="${options.seo_description!}" canonical="${context!}">
<#list posts.content as post>
<@article post,true />
</#list>
<% if (page.total > 1) { %>
<%- partial('common/paginator') %>
<% } %>
</@layout>
File renamed without changes.
126 changes: 0 additions & 126 deletions layout/common/article.ejs

This file was deleted.

137 changes: 137 additions & 0 deletions layout/common/article.ftl
@@ -0,0 +1,137 @@
<#macro article post,index>
<div class="card">
<#if post.thumbnail?? && post.thumbnail!=''>
<div class="card-image">
<#if index>
<a href="${context!}/archives/${post.url!}"
<img class="thumbnail" src="${post.thumbnail!}" alt="${post.title!}">
</a>
<#else>
<span class="image is-7by1">
<img class="thumbnail" src="${post.thumbnail!}" alt="${post.title!}">
</span>
</#if>
</div>
</#if>
<div class="card-content article <%= post.hasOwnProperty('direction') ? post.direction : '' %>">
<#-- <% if (post.layout != 'page') { %>-->
<#-- <div class="level article-meta is-size-7 is-uppercase is-mobile is-overflow-x-auto">-->
<#-- <div class="level-left">-->
<#-- <time class="level-item has-text-grey" datetime="<%= date_xml(post.date) %>"><%= date(post.date) %></time>-->
<#-- <% if (post.categories && post.categories.length) { %>-->
<#-- <div class="level-item">-->
<#-- <%- list_categories(post.categories, {-->
<#-- class: 'has-link-grey ',-->
<#-- show_count: false,-->
<#-- style: 'none',-->
<#-- separator: '&nbsp;/&nbsp;'-->
<#-- }) %>-->
<#-- </div>-->
<#-- <% } %>-->
<#-- <% if (!has_config('article.readtime') || get_config('article.readtime') === true) { %>-->
<#-- <span class="level-item has-text-grey">-->
<#-- <% const words = word_count(post._content); %>-->
<#-- <% const time = duration((words / 150.0) * 60, 'seconds') %>-->
<#-- <%= `${ time.locale(get_config('language', 'en')).humanize() } ${ __('article.read')} (${ __('article.about') } ${ words } ${ __('article.words') })` %>-->
<#-- </span>-->
<#-- <% } %>-->
<#-- <% if (!index && (has_config('plugins.busuanzi') ? get_config('plugins.busuanzi') : false)) { %>-->
<#-- <span class="level-item has-text-grey" id="busuanzi_container_page_pv">-->
<#-- <i class="far fa-eye"></i>-->
<#-- <%- _p('plugin.visit', '<span id="busuanzi_value_page_pv">0</span>') %>-->
<#-- </span>-->
<#-- <% } %>-->
<#-- </div>-->
<#-- </div>-->
<#-- <% } %>-->
<h1 class="title is-size-3 is-size-4-mobile has-text-weight-normal">
<#if index>
<a class="has-link-black-ter" href="${context!}/archives/${post.url!}">${post.title!}</a>
<#else>
${post.title!}
</#if>
</h1>
<div class="content">
<#if index && post.summary?? && post.summary!=''>
${post.summary!}
<#else>
${post.formatContent!}
</#if>
</div>
<#if !index && tags?? && (tags?size gt 0)>
<div class="level is-size-7 is-uppercase">
<div class="level-start">
<div class="level-item">
<span class="is-size-6 has-text-grey has-mr-7">#</span>
<#list tags as tag>
<a class="has-link-grey -link" href="${context!}/tags/${tag.slugName!}">${tag.name!}</a>
</#list>
</div>
</div>
</div>
</#if>
<#if index && post.summary?? && post.summary!=''>
<div class="level is-mobile">
<div class="level-start">
<div class="level-item">
<a class="button is-size-7 is-light" href="${context!}/archives/${post.url!}#more">阅读更多</a>
</div>
</div>
</div>
</#if>
<% if (!index && has_config('share.type')) { %>
<%- partial('share/' + get_config('share.type')) %>
<% } %>
</div>
</div>

<% const services = has_config('donate') ? get_config('donate') : []; %>
<% if (!index && services.length > 0) { %>
<div class="card">
<div class="card-content">
<h3 class="menu-label has-text-centered"><%= __('donate.title') %></h3>
<div class="buttons is-centered">
<% for (let service of services) {
const type = get_config_from_obj(service, 'type');
if (type !== null) { %>
<%- partial('donate/' + type, { type, service }) %>
<% }
} %>
</div>
</div>
</div>
<% } %>

<#if !index && nextPost?? && prePost??>
<div class="card card-transparent">
<div class="level post-navigation is-flex-wrap is-mobile">
<#if prePost??>
<div class="level-start">
<a class="level level-item has-link-grey article-nav-prev" href="${context!}/archives/${prePost.url}">
<i class="level-item fas fa-chevron-left"></i>
<span class="level-item">上一篇</span>
</a>
</div>
</#if>
<#if nextPost??>
<div class="level-end">
<a class="level level-item has-link-grey article-nav-next" href="${context!}/archives/${nextPost.url}">
<span class="level-item">下一篇</span>
<i class="level-item fas fa-chevron-right"></i>
</a>
</div>
</#if>
</div>
</div>
</#if>

<#if !index>
<div class="card">
<div class="card-content">
<h3 class="title is-5 has-text-weight-normal">评论</h3>
<%- partial('comment/' + get_config('comment.type')) %>
<@global.comment post,"post" />
</div>
</div>
</#if>
</#macro>
18 changes: 9 additions & 9 deletions layout/common/footer.ejs → layout/common/footer.ftl
Expand Up @@ -2,17 +2,17 @@
<div class="container">
<div class="level">
<div class="level-start has-text-centered-mobile">
<a class="footer-logo is-block has-mb-6" href="<%- url_for('/') %>">
<% if (has_config('logo.text') && get_config('logo.text')) { %>
<%= get_config('logo.text') %>
<% } else { %>
<img src="<%- url_for(get_config('logo')) %>" alt="<%= get_config('title') %>" height="28">
<% } %>
<a class="footer-logo is-block has-mb-6" href="${context!}">
<#if options.blog_logo?? && options.blog_logo!=''>
<img src="${options.blog_logo!}" alt="${options.blog_title!}" height="28">
<#else>
${options.blog_title!}
</#if>
</a>
<p class="is-size-7">
&copy; <%= date(new Date(), 'YYYY') %> <%= get_config('author') || get_config('title') %>&nbsp;
Powered by <a href="https://hexo.io/" target="_blank">Hexo</a> & <a
href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank">Icarus</a>
&copy; ${.now?string('yyyy')} ${user.nickname!}&nbsp;
Powered by <a href="https://halo.run/" target="_blank">Halo</a> & <a
href="https://github.com/halo-dev/halo-theme-icarus" target="_blank">Icarus</a>
<% if (has_config('plugins.busuanzi') ? get_config('plugins.busuanzi') : false) { %>
<br>
<span id="busuanzi_container_site_uv">
Expand Down
43 changes: 0 additions & 43 deletions layout/common/head.ejs

This file was deleted.

Empty file added layout/common/head.ftl
Empty file.
33 changes: 18 additions & 15 deletions layout/common/navbar.ejs → layout/common/navbar.ftl
@@ -1,23 +1,25 @@
<#macro navbar layout>
<nav class="navbar navbar-main">
<div class="container">
<div class="navbar-brand is-flex-center">
<a class="navbar-item navbar-logo" href="<%- url_for('/') %>">
<% if (has_config('logo.text') && get_config('logo.text')) { %>
<%= get_config('logo.text') %>
<% } else { %>
<img src="<%- url_for(get_config('logo')) %>" alt="<%= get_config('title') %>" height="28">
<% } %>
<a class="navbar-item navbar-logo" href="${context!}">
<#if options.blog_logo?? && options.blog_logo!=''>
<img src="${options.blog_logo!}" alt="${options.blog_title!}" height="28">
<#else>
${options.blog_title!}
</#if>
</a>
</div>
<div class="navbar-menu">
<% if (has_config('navbar.menu')) { %>
<div class="navbar-start">
<% for (let i in get_config('navbar.menu')) { let menu = get_config('navbar.menu')[i]; %>
<a class="navbar-item<% if (typeof(page.path) !== 'undefined' && is_same_link(menu, page.path)) { %> is-active<% } %>"
href="<%- url_for(menu) %>"><%= i %></a>
<% } %>
</div>
<% } %>
<@menuTag method="list">
<#if menus?? && menus?size gt 0>
<div class="navbar-start">
<#list menus?sort_by('priority') as menu>
<a class="navbar-item" href="${menu.url}" target="${menu.target!}">${menu.name}</a>
</#list>
</div>
</#if>
</@menuTag>
<div class="navbar-end">
<% if (has_config('navbar.links')) { %>
<% let links = get_config('navbar.links'); %>
Expand Down Expand Up @@ -45,4 +47,5 @@
</div>
</div>
</div>
</nav>
</nav>
</#macro>
File renamed without changes.
File renamed without changes.

0 comments on commit 9ff9910

Please sign in to comment.