Skip to content

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Nov 13, 2018
1 parent 51b9605 commit 25833c1
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion archives.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#include "default.ftl">
<@default title="文章归档 | ${options.blog_title}" keyword="${options.seo_keywords?if_exists}" desc="${options.seo_desc?if_exists}" canonical="${options.blog_url}/archives" body_class="page-template">
<@default title="文章归档 | ${options.blog_title!}" keyword="${options.seo_keywords!}" desc="${options.seo_desc!}" canonical="${options.blog_url}/archives" body_class="page-template">

<#-- The tag above means: insert everything in this file
into the {body} of the default.hbs template -->
Expand Down
4 changes: 2 additions & 2 deletions category.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#include "default.ftl">
<#include "partials/post-card.ftl">
<@default title="分类:${category.cateName} | ${options.blog_title}" keyword="${options.seo_keywords?if_exists}" desc="${options.seo_desc?if_exists}" canonical="${options.blog_url}/categories/${category.cateName}" body_class="tag-template">
<@default title="分类:${category.cateName!} | ${options.blog_title!}" keyword="${options.seo_keywords!}" desc="${options.seo_desc!}" canonical="${options.blog_url}/categories/${category.cateName}" body_class="tag-template">
<#-- The tag above means - insert everything in this file into the {body} of the default.hbs template -->
<#-- The big featured header, it uses blog cover image as a BG if available -->
<header class="site-header outer <#if options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg') != ''>" style="background-image: url(${options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg')})<#else>no-cover</#if>">
Expand All @@ -9,7 +9,7 @@
<div class="site-header-content">
<h1 class="site-title">分类:${category.cateName}</h1>
<h2 class="site-description">
<#if category.cateDesc?? && category.cateDesc?if_exists!=''>
<#if category.cateDesc?? && (category.cateDesc!'')!=''>
${category.cateDesc}
<#else>
${category.posts?size}篇文章
Expand Down
4 changes: 2 additions & 2 deletions default.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
<meta property="og:title" content="${title}" />
<meta property="og:description" content="${desc}" />
<meta property="og:url" content="${canonical}" />
<meta property="og:image" content="${options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg')}" />
<meta property="og:image" content="${options.casper_general_cover!'/${themeName}/assets/images/blog-cover.jpg'}" />
<meta property="article:publisher" content="https://www.facebook.com/ghost" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="${title}" />
<meta name="twitter:description" content="${desc}" />
<meta name="twitter:url" content="${canonical}" />
<meta name="twitter:image" content="${options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg')}" />
<meta name="twitter:image" content="${options.casper_general_cover!'/${themeName}/assets/images/blog-cover.jpg'}" />
<meta name="twitter:site" content="@tryghost" />
<meta property="og:image:width" content="2000" />
<meta property="og:image:height" content="666" />
Expand Down
10 changes: 5 additions & 5 deletions index.ftl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<#include "default.ftl">
<#include "partials/post-card.ftl">
<@default title="${options.blog_title}" keyword="${options.seo_keywords?if_exists}" desc="${options.seo_desc?if_exists}" canonical="${options.blog_url}" body_class="home-template">
<@default title="${options.blog_title!}" keyword="${options.seo_keywords!}" desc="${options.seo_desc!}" canonical="${options.blog_url}" body_class="home-template">
<#-- The tag above means: insert everything in this file
into the {body} of the default.hbs template -->

<#-- The big featured header, it uses blog cover image as a BG if available -->
<header class="site-header outer <#if options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg') != ''>" style="background-image: url(${options.casper_general_cover?default('/${themeName}/assets/images/blog-cover.jpg')})<#else>no-cover</#if>">
<header class="site-header outer <#if (options.casper_general_cover!'/${themeName}/assets/images/blog-cover.jpg') != ''>" style="background-image: url(${options.casper_general_cover!'/${themeName}/assets/images/blog-cover.jpg'})<#else>no-cover</#if>">
<div class="inner">
<div class="site-header-content">
<h1 class="site-title">
<#if options.blog_logo??>
<img class="site-logo" src="${options.blog_logo}" alt="${options.blog_title}" />
<img class="site-logo" src="${options.blog_logo}" alt="${options.blog_title!}" />
<#else>
${options.blog_title}
${options.blog_title!}
</#if>
</h1>
<h2 class="site-description">${user.userDesc?if_exists}</h2>
<h2 class="site-description">${user.userDesc!}</h2>
</div>
<#include "partials/site-nav.ftl">
</div>
Expand Down
2 changes: 1 addition & 1 deletion links.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#include "default.ftl">
<@default title="友情链接 | ${options.blog_title}" keyword="${options.seo_keywords?if_exists}" desc="${options.seo_desc?if_exists}" canonical="${options.blog_url}/links" body_class="page-template">
<@default title="友情链接 | ${options.blog_title!}" keyword="${options.seo_keywords!}" desc="${options.seo_desc!}" canonical="${options.blog_url}/links" body_class="page-template">

<#-- The tag above means: insert everything in this file
into the {body} of the default.hbs template -->
Expand Down
2 changes: 1 addition & 1 deletion module/comment.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<#if post.allowComment?default(1)==1>
<#if (post.allowComment!1)==1>
<#include "/common/comment/_native_comment.ftl">
</#if>

38 changes: 19 additions & 19 deletions module/options.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<label for="casperGeneralCover" class="col-sm-4 control-label">首页背景图:</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control" id="casperGeneralCover" name="casper_general_cover" value="${options.casper_general_cover?default('/casper/assets/images/blog-cover.jpg')}" >
<input type="text" class="form-control" id="casperGeneralCover" name="casper_general_cover" value="${options.casper_general_cover!'/casper/assets/images/blog-cover.jpg'}" >
<span class="input-group-btn">
<button class="btn btn-default btn-flat" type="button" onclick="openAttach('casperGeneralCover')">选择</button>
</span>
Expand All @@ -38,7 +38,7 @@
<label for="casperGeneralLinksCover" class="col-sm-4 control-label">友情链接背景图:</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control" id="casperGeneralLinksCover" name="casper_general_links_cover" value="${options.casper_general_links_cover?if_exists}" >
<input type="text" class="form-control" id="casperGeneralLinksCover" name="casper_general_links_cover" value="${options.casper_general_links_cover!}" >
<span class="input-group-btn">
<button class="btn btn-default btn-flat" type="button" onclick="openAttach('casperGeneralLinksCover')">选择</button>
</span>
Expand All @@ -49,7 +49,7 @@
<label for="casperGeneralArchivesCover" class="col-sm-4 control-label">归档背景图:</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control" id="casperGeneralArchivesCover" name="casper_general_archives_cover" value="${options.casper_general_archives_cover?if_exists}" >
<input type="text" class="form-control" id="casperGeneralArchivesCover" name="casper_general_archives_cover" value="${options.casper_general_archives_cover!}" >
<span class="input-group-btn">
<button class="btn btn-default btn-flat" type="button" onclick="openAttach('casperGeneralArchivesCover')">选择</button>
</span>
Expand All @@ -60,17 +60,17 @@
<label for="casperGeneralPostCopyright" class="col-sm-4 control-label">文章版权:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="casper_general_post_copyright" id="casperGeneralPostCopyright" value="true" ${((options.casper_general_post_copyright?default('true'))=='true')?string('checked','')}> 显示
<input type="radio" name="casper_general_post_copyright" id="casperGeneralPostCopyright" value="true" ${((options.casper_general_post_copyright!'true')=='true')?string('checked','')}> 显示
</label>
<label class="radio-inline">
<input type="radio" name="casper_general_post_copyright" id="casperGeneralPostCopyright" value="false" ${((options.casper_general_post_copyright?if_exists)=='false')?string('checked','')}> 隐藏
<input type="radio" name="casper_general_post_copyright" id="casperGeneralPostCopyright" value="false" ${((options.casper_general_post_copyright!)=='false')?string('checked','')}> 隐藏
</label>
</div>
</div>
<div class="form-group">
<label for="casperGeneralLocation" class="col-sm-4 control-label">所在地:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperGeneralLocation" name="casper_general_location" value="${options.casper_general_location?if_exists}" >
<input type="text" class="form-control" id="casperGeneralLocation" name="casper_general_location" value="${options.casper_general_location!}" >
</div>
</div>
</div>
Expand All @@ -87,77 +87,77 @@
<label for="casperSnsRss" class="col-sm-4 control-label">RSS:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="casper_sns_rss" id="casperSnsRss" value="true" ${((options.casper_sns_rss?default('true'))=='true')?string('checked','')}> 显示
<input type="radio" name="casper_sns_rss" id="casperSnsRss" value="true" ${((options.casper_sns_rss!'true')=='true')?string('checked','')}> 显示
</label>
<label class="radio-inline">
<input type="radio" name="casper_sns_rss" id="casperSnsRss" value="false" ${((options.casper_sns_rss?if_exists)=='false')?string('checked','')}> 隐藏
<input type="radio" name="casper_sns_rss" id="casperSnsRss" value="false" ${((options.casper_sns_rss!)=='false')?string('checked','')}> 隐藏
</label>
</div>
</div>
<div class="form-group">
<label for="casperSnsTwitter" class="col-sm-4 control-label">Twitter:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsTwitter" name="casper_sns_twitter" value="${options.casper_sns_twitter?if_exists}" >
<input type="text" class="form-control" id="casperSnsTwitter" name="casper_sns_twitter" value="${options.casper_sns_twitter!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsFacebook" class="col-sm-4 control-label">Facebook:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsFacebook" name="casper_sns_facebook" value="${options.casper_sns_facebook?if_exists}" >
<input type="text" class="form-control" id="casperSnsFacebook" name="casper_sns_facebook" value="${options.casper_sns_facebook!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsInstagram" class="col-sm-4 control-label">Instagram:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsInstagram" name="casper_sns_instagram" value="${options.casper_sns_instagram?if_exists}" >
<input type="text" class="form-control" id="casperSnsInstagram" name="casper_sns_instagram" value="${options.casper_sns_instagram!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsDribbble" class="col-sm-4 control-label">Dribbble:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsDribbble" name="casper_sns_dribbble" value="${options.casper_sns_dribbble?if_exists}" >
<input type="text" class="form-control" id="casperSnsDribbble" name="casper_sns_dribbble" value="${options.casper_sns_dribbble!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsWeibo" class="col-sm-4 control-label">Weibo:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsWeibo" name="casper_sns_weibo" value="${options.casper_sns_weibo?if_exists}" >
<input type="text" class="form-control" id="casperSnsWeibo" name="casper_sns_weibo" value="${options.casper_sns_weibo!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsEmail" class="col-sm-4 control-label">Email:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsEmail" name="casper_sns_email" value="${options.casper_sns_email?if_exists}" >
<input type="text" class="form-control" id="casperSnsEmail" name="casper_sns_email" value="${options.casper_sns_email!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsGithub" class="col-sm-4 control-label">Github:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsGithub" name="casper_sns_github" value="${options.casper_sns_github?if_exists}" >
<input type="text" class="form-control" id="casperSnsGithub" name="casper_sns_github" value="${options.casper_sns_github!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsQQ" class="col-sm-4 control-label">QQ:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsQQ" name="casper_sns_qq" value="${options.casper_sns_qq?if_exists}" >
<input type="text" class="form-control" id="casperSnsQQ" name="casper_sns_qq" value="${options.casper_sns_qq!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsTelegram" class="col-sm-4 control-label">Telegram:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsTelegram" name="casper_sns_telegram" value="${options.casper_sns_telegram?if_exists}" >
<input type="text" class="form-control" id="casperSnsTelegram" name="casper_sns_telegram" value="${options.casper_sns_telegram!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsCnBLog" class="col-sm-4 control-label">博客园:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsCnBLog" name="casper_sns_cnblog" value="${options.casper_sns_cnblog?if_exists}" >
<input type="text" class="form-control" id="casperSnsCnBLog" name="casper_sns_cnblog" value="${options.casper_sns_cnblog!}" >
</div>
</div>
<div class="form-group">
<label for="casperSnsStackoverflow" class="col-sm-4 control-label">Stack Overflow:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="casperSnsStackoverflow" name="casper_sns_stackoverflow" value="${options.casper_sns_stackoverflow?if_exists}" >
<input type="text" class="form-control" id="casperSnsStackoverflow" name="casper_sns_stackoverflow" value="${options.casper_sns_stackoverflow!}" >
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion page.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#include "default.ftl">
<@default title="${post.postTitle} | ${options.blog_title}" keyword="${options.seo_keywords?if_exists}" desc="${post.postSummary?if_exists}" canonical="${options.blog_url}/p/${post.postUrl}" body_class="page-template">
<@default title="${post.postTitle} | ${options.blog_title!}" keyword="${options.seo_keywords!}" desc="${post.postSummary!}" canonical="${options.blog_url}/p/${post.postUrl}" body_class="page-template">

<#-- The tag above means: insert everything in this file
into the {body} of the default.hbs template -->
Expand Down
Loading

0 comments on commit 25833c1

Please sign in to comment.