Skip to content

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Dec 30, 2018
1 parent af12bd6 commit 976017a
Show file tree
Hide file tree
Showing 33 changed files with 329 additions and 336 deletions.
4 changes: 2 additions & 2 deletions archives.ftl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#include "layout/_layout.ftl">
<#include "layout/_macro/post-collapse.ftl">
<#include "layout/_macro/sidebar.ftl">
<@html title=" 归档 | ${options.blog_title?default('NexT')}" keywords="${options.seo_keywords?default('NexT')}" desc="${options.seo_desc?default('NexT')}" ogtype="website" url="${options.blog_url?if_exists}/archives">page-archive</@html>
<@html title=" 归档 | ${options.blog_title!'Next'}" keywords="${options.seo_keywords!'Next'}" desc="${options.seo_desc!'Next'}" ogtype="website" url="${options.blog_url!}/archives">page-archive</@html>

<@main useComment=false>
<div class="post-block archive">
Expand All @@ -27,7 +27,7 @@
<@articleTag method="archivesLess">
<#list archivesLess as archive>
<div class="collection-title">
<<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if> class="archive-year" id="archive-year-${archive.year}">${archive.year}</<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if>>
<<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if> class="archive-year" id="archive-year-${archive.year}">${archive.year}</<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if>>
</div>
<@post_collapase archive.posts></@post_collapase>
</#list>
Expand Down
4 changes: 2 additions & 2 deletions categories.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<#include "layout/_macro/sidebar.ftl">
<#include "layout/_partials/page-header.ftl">

<@html title=" 分类 | ${options.blog_title?default('NexT')}" keywords="${options.seo_keywords?default('NexT')}" desc="${options.seo_desc?default('NexT')}" ogtype="website" url="${options.blog_url?if_exists}/categories"></@html>
<@html title=" 分类 | ${options.blog_title!'Next'}" keywords="${options.seo_keywords!'Next'}" desc="${options.seo_desc!'Next'}" ogtype="website" url="${options.blog_url!}/categories"></@html>

<@main useComment=false>
<div id="posts" class="posts-expand">
<div class="post-block page">
<@page_header "分类"></@page_header>
<div class="post-body<#if options.next_plugins_han?default('false')=='true'> han-init-context</#if>">
<div class="post-body<#if (options.next_plugins_han!'false')=='true'> han-init-context</#if>">
<div class="category-all-page">
<div class="category-all-title">
<#if categories?? && categories?size gt 0>
Expand Down
6 changes: 3 additions & 3 deletions category.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<#include "layout/_macro/post-collapse.ftl">
<#include "layout/_macro/sidebar.ftl">

<@html title=" 分类: ${category.cateName} | ${options.blog_title?default('NexT')}" keywords="${options.seo_keywords?default('NexT')}" desc="${options.seo_desc?default('NexT')}" ogtype="website" url="${options.blog_url?if_exists}/categories/${category.cateUrl?if_exists}">
<@html title=" 分类: ${category.cateName!} | ${options.blog_title!'Next'}" keywords="${options.seo_keywords!'Next'}" desc="${options.seo_desc!'Next'}" ogtype="website" url="${options.blog_url!}/categories/${category.cateUrl!}">
</@html>

<@main useComment=false>
<div class="post-block category">
<div id="posts" class="posts-collapse">
<div class="collection-title">
<<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if>>
<<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if>>
${category.cateName}
<small>分类</small>
</<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if>>
</<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if>>
</div>
<@post_collapase posts=posts.content></@post_collapase>
</div>
Expand Down
2 changes: 1 addition & 1 deletion index.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<#include "layout/_macro/post.ftl">
<#include "layout/_macro/sidebar.ftl">

<@html title="${options.blog_title?default('NexT')}" keywords="${options.seo_keywords?default('NexT')}" desc="${options.seo_desc?default('NexT')}" ogtype="website" url="${options.blog_url?if_exists}"></@html>
<@html title="${options.blog_title!'NexT'}" keywords="${options.seo_keywords!'Next'}" desc="${options.seo_desc!'Next'}" ogtype="website" url="${options.blog_url!}"></@html>

<@main useComment=false>
<section id="posts" class="posts-expand">
Expand Down
12 changes: 6 additions & 6 deletions layout/_layout.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<#macro html title,keywords,desc,ogtype,url>
<!DOCTYPE html>

<html class="theme-next ${options.next_general_scheme?default('Muse')?lower_case} <#if options.next_other_motion_enable?default('true')=='true'>use-motion</#if>"
<html class="theme-next ${(options.next_general_scheme!'Muse')?lower_case} <#if (options.next_other_motion_enable!'true')=='true'>use-motion</#if>"
lang="zh-Hans">
<head>
<#include "_partials/head.ftl">
Expand All @@ -12,7 +12,7 @@

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

<div class="container sidebar-position-${options.next_style_sidebar_position?default('left')} <#nested />">
<div class="container sidebar-position-${options.next_style_sidebar_position!'left'} <#nested />">
<div class="headband"></div>

<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
Expand All @@ -33,7 +33,7 @@
</div>
</#macro>
<#macro sidebar>
<#if options.next_style_sidebar_display?default('post')!='remove'>
<#if (options.next_style_sidebar_display!'post')!='remove'>
<#nested />
</#if>
</div>
Expand All @@ -51,10 +51,10 @@
</#macro>

<#macro button>
<#if options.next_style_sidebar_b2t?default('false')=='false'>
<#if (options.next_style_sidebar_b2t!'false')=='false'>
<div class="back-to-top" style="width: initial">
<i class="fa fa-arrow-up"></i>
<#if options.next_style_sidebar_scrollpercent?default('false')=='true'>
<#if (options.next_style_sidebar_scrollpercent!'false')=='true'>
<span id="scrollpercent"><span>0</span>%</span>
</#if>
</div>
Expand All @@ -65,7 +65,7 @@
<#include "_scripts/vendors.ftl">
<#include "_scripts/commons.ftl">

<#include "../layout/_scripts/schemes/${options.next_general_scheme?default('Muse')?lower_case}.ftl">
<#include "../layout/_scripts/schemes/${(options.next_general_scheme!'Muse')?lower_case}.ftl">
<#nested />
<#include "_scripts/boostrap.ftl">
<#include "_third-party/search/index.ftl">
Expand Down
4 changes: 2 additions & 2 deletions layout/_macro/post-collapse.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<#list posts as post>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if> class="post-title">
<<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if> class="post-title">
<a class="post-title-link" href="/archives/${post.postUrl}" itemprop="url">
<span itemprop="name">${post.postTitle}</span>
</a>
</<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if>>
</<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if>>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated" datetime="${post.postDate}" content="${post.postDate?string("yyyy-MM-dd")}">
${post.postDate?string("MM-dd")}
Expand Down
6 changes: 3 additions & 3 deletions layout/_macro/post-copyright.ftl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<ul class="post-copyright">
<li class="post-copyright-author">
<strong>本文作者:</strong>
${user.userDisplayName?if_exists}
${user.userDisplayName!}
</li>
<li class="post-copyright-link">
<strong>本文链接:</strong>
<a href="${options.blog_url}/archives/${post.postUrl}" title="${post.postTitle}">${options.blog_url}/archives/${post.postUrl}</a>
<a href="${options.blog_url!}/archives/${post.postUrl!}" title="${post.postTitle!}">${options.blog_url!}/archives/${post.postUrl!}</a>
</li>
<li class="post-copyright-license">
<strong>版权声明:</strong>
本博客所有文章除特别声明外,均采用<a href="${options.next_other_post_copyright_license_url?default('https://creativecommons.org/licenses/by-nc-sa/3.0/')}" rel="external nofollow" target="_blank">${options.next_other_post_copyright_license?default('CC BY-NC-SA 3.0')}</a> 许可协议。转载请注明出处!
本博客所有文章除特别声明外,均采用<a href="${options.next_other_post_copyright_license_url!'https://creativecommons.org/licenses/by-nc-sa/3.0/'}" rel="external nofollow" target="_blank">${options.next_other_post_copyright_license!'CC BY-NC-SA 3.0'}</a> 许可协议。转载请注明出处!
</li>
</ul>
20 changes: 10 additions & 10 deletions layout/_macro/post.ftl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<#macro post_template post>
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="${options.blog_url}/archives/${post.postUrl}">
<link itemprop="mainEntityOfPage" href="${options.blog_url!}/archives/${post.postUrl}">
<span hidden="" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="name" content="${user.userDisplayName?if_exists}">
<meta itemprop="description" content="${post.postSummary?if_exists}">
<meta itemprop="image" content="${user.userAvatar?if_exists}">
<meta itemprop="name" content="${user.userDisplayName!}">
<meta itemprop="description" content="${post.postSummary!}">
<meta itemprop="image" content="${user.userAvatar!}">
</span>
<span hidden="" itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="${options.blog_title?if_exists}">
<meta itemprop="name" content="${options.blog_title!}">
</span>
<header class="post-header">
<<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if> class="post-title" itemprop="name headline">
<<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if> class="post-title" itemprop="name headline">
<a class="post-title-link" href="/archives/${post.postUrl}" itemprop="url">${post.postTitle}</a>
</<#if options.next_other_seo?default('false')=='true'>h2<#else>h1</#if>>
</<#if (options.next_other_seo!'false')=='true'>h2<#else>h1</#if>>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
Expand Down Expand Up @@ -52,7 +52,7 @@
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读次数 </span>
<span class="leancloud-visitors-count">${post.postViews?default(0)?c}</span>
<span class="leancloud-visitors-count">${(post.postViews!0)?c}</span>
</span>
</span>
</div>
Expand All @@ -71,7 +71,7 @@
${post.postContent}
</#if>
</div>
<#if options.next_general_wechat_subscriber_enable?default('false')=='true' && !is_index??>
<#if (options.next_general_wechat_subscriber_enable!'false')=='true' && !is_index??>
<div>
<#include "wechat-subscriber.ftl">
</div>
Expand All @@ -81,7 +81,7 @@
<#include "reward.ftl">
</div>
</#if>
<#if options.next_other_post_copyright?default('true')=='true' && !is_index??>
<#if (options.next_other_post_copyright!'true')=='true' && !is_index??>
<div>
<#include "post-copyright.ftl">
</div>
Expand Down
14 changes: 7 additions & 7 deletions layout/_macro/reward.ftl
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
<div>${options.next_other_reward_comment?if_exists}</div>
<div>${options.next_other_reward_comment!}</div>
<button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
<span>打赏</span>
</button>
<div id="QR" style="display: none;">
<#if options.next_other_wechatpay?if_exists !=''>
<#if options.next_other_wechatpay??>
<div id="wechat" style="display: inline-block">
<img id="wechat_qr" src="${options.next_other_wechatpay}" alt="${user.DisplayName?if_exists} 微信支付"/>
<img id="wechat_qr" src="${options.next_other_wechatpay}" alt="${user.DisplayName!} 微信支付"/>
<p>微信支付</p>
</div>
</#if>

<#if options.next_other_alipay?if_exists !=''>
<#if options.next_other_alipay??>
<div id="alipay" style="display: inline-block">
<img id="alipay_qr" src="${options.next_other_alipay}" alt="${user.DisplayName?if_exists} 支付宝"/>
<img id="alipay_qr" src="${options.next_other_alipay}" alt="${user.DisplayName!} 支付宝"/>
<p>支付宝</p>
</div>
</#if>

<#if options.next_other_bitcoin?if_exists !=''>
<#if options.next_other_bitcoin??>
<div id="bitcoin" style="display: inline-block">
<img id="bitcoin_qr" src="${options.next_other_bitcoin}" alt="${user.DisplayName?if_exists} 比特币"/>
<img id="bitcoin_qr" src="${options.next_other_bitcoin}" alt="${user.DisplayName!} 比特币"/>
<p>比特币</p>
</div>
</#if>
Expand Down
Loading

0 comments on commit 976017a

Please sign in to comment.