Skip to content

Commit

Permalink
feat: new footer, add show_subscribe config for article layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Dec 27, 2018
1 parent 1ce48d0 commit 34d7fe1
Show file tree
Hide file tree
Showing 24 changed files with 259 additions and 280 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ defaults:
aside:
toc: true
show_edit_on_github: true
show_subscribe: true
pageview: true


Expand Down
21 changes: 5 additions & 16 deletions _data/locale.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
NAV:
HOME:
en: "Home"
zh: "主页"
zh-Hans: "主页"
zh-Hant: "主頁"
ALL:
en: "Archive"
zh: "归档"
zh-Hans: "归档"
zh-Hant: "歸檔"
RSS:
en: "RSS"
zh: "RSS"
zh-Hans: "RSS"
zh-Hant: "RSS"
SUBSCRIBE:
en: "Subscribe"
zh: "订阅"
zh-Hans: "订阅"
zh-Hant: "訂閱"

READMORE:
en: "Read more"
Expand Down
1 change: 1 addition & 0 deletions _data/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ default:
show_date: true
show_tags: true
show_author_profile: false
show_subscribe: false
full_width: false
sharing: false
comment: true
Expand Down
55 changes: 55 additions & 0 deletions _includes/article-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{%- include snippets/assign.html
target=site.data.variables.default.page.show_author_profile
source0=layout.show_author_profile source1=page.show_author_profile -%}
{%- assign _show_author_profile = __return -%}

{%- include snippets/assign.html
target=site.data.variables.default.page.show_subscribe
source0=layout.show_subscribe source1=page.show_subscribe -%}
{%- assign _show_subscribe = __return -%}

{%- include snippets/assign.html
target=site.data.variables.default.page.license
source0=layout.license source1=page.license -%}
{%- assign _license = __return -%}

<footer class="article__footer">
{%- if page.modify_date -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.ARTICLE_DATE_FORMAT -%}
{%- assign _locale_date_format = __return -%}

{%- include snippets/locale-to-string.html locale=site.data.locale.LAST_UPDATED -%}
{%- assign _locale_last_update = __return -%}
<span>{{ _locale_last_update }}
<time itemprop="dateModified" datetime="{{ page.modify_date | date_to_xmlschema }}">{{ page.modify_date | date: _locale_date_format }}</time>
</span>
{%- elsif page.date -%}
<meta itemprop="dateModified" content="{{ page.date | date_to_xmlschema }}">
{%- endif -%}

{%- include article/footer/custom.html -%}

{%- if _show_author_profile -%}
{%- if page.author -%}
{%- assign _author = site.data.authors[page.author] -%}
{%- else -%}
{%- assign _author = site.author -%}
{%- endif -%}
{%- include article/footer/author-profile.html author=_author -%}
{%- endif -%}

{%- if _show_subscribe -%}
<div class="article__subscribe">{%- include article/footer/subscribe.html -%}</div>
{%- endif -%}

{%- if _license != false -%}
{%- assign _data_license = site.data.licenses-%}
{%- if site.license -%}
{%- assign _license_data = _data_license[site.license] -%}
{%- endif -%}
{%- if _license != true -%}
{%- assign _license_data = _data_license[_license] -%}
{%- endif -%}
<div class="article__license">{%- include article/footer/license.html license=_license_data -%}</div>
{%- endif -%}
</footer>
6 changes: 6 additions & 0 deletions _includes/article/footer/subscribe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{%- assign _paths_rss = site.paths.rss | default: site.data.variables.default.paths.rss -%}
{%- include snippets/get-nav-url.html path=_paths_rss -%}
{%- assign _paths_rss = __return -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.SUBSCRIBE -%}
{%- assign _locale_nav_subscribe = __return -%}
<div class="subscribe"><i class="fas fa-rss"></i> <a type="application/rss+xml" href="{{ _paths_rss }}">{{ _locale_nav_subscribe }}</a></div>
23 changes: 8 additions & 15 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<footer class="footer js-page-footer">
<footer class="footer py-4 js-page-footer">
<div class="main">

{%- assign _site_author = site.author -%}
Expand All @@ -9,7 +9,7 @@
{%- assign _site_author_itemtype = 'http://schema.org/Person' -%}
{%- endif -%}

<div itemscope itemtype="{{ _site_author_itemtype }}">
<div itemscope itemtype="{{ _site_author_itemtype }}">
<meta itemprop="name" content="{{ _site_author.name }}">
{%- assign _site_author_url = _site_author.url | default: '/'-%}
{%- include snippets/get-nav-url.html path=_site_author_url -%}
Expand All @@ -22,19 +22,12 @@
{%- include author-links.html author=_site_author -%}
</div>
</div>
<div class="site-info">
{%- assign _paths_rss = site.paths.rss | default: site.data.variables.default.paths.rss -%}
{%- include snippets/get-nav-url.html path=_paths_rss -%}
{%- assign _paths_rss = __return -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.NAV.RSS -%}
{%- assign _locale_nav_rss = __return -%}
<p class="menu menu--center">
<span>© {{ site.title }} {{ site.data.locale.COPYRIGHT_DATES }}</span>
<a type="application/rss+xml" href="{{ _paths_rss }}">{{ _locale_nav_rss }}</a>
</p>
<p>Powered by <a title="Jekyll is a simple, blog-aware, static site generator." href="http://jekyllrb.com/">Jekyll</a> & <a
title="TeXt is a succinct theme for blogging." href="https://github.com/kitian616/jekyll-TeXt-theme">TeXt Theme</a>.
</p>
<div class="site-info mt-2">
<div>
© {{ site.title }} {{ site.data.locale.COPYRIGHT_DATES }},
Powered by <a title="Jekyll is a simple, blog-aware, static site generator." href="http://jekyllrb.com/">Jekyll</a> & <a
title="TeXt is a super customizable Jekyll theme." href="https://github.com/kitian616/jekyll-TeXt-theme">TeXt Theme</a>.
</div>
</div>
</div>
</footer>
1 change: 1 addition & 0 deletions _includes/scripts/lib/scroll-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
window.Lazyload.js(SOURCES.jquery, function() {
function scrollToAnchor(anchor, duration, callback) {
var $root = this;
console.log($(anchor).position().top);
$root.animate({ scrollTop: $(anchor).position().top }, duration, function() {
window.history.replaceState(null, '', window.location.href.split('#')[0] + anchor);
callback && callback();
Expand Down
54 changes: 3 additions & 51 deletions _layouts/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,18 @@
source0=layout.sharing source1=page.sharing -%}
{%- assign _sharing = __return -%}


{%- include snippets/assign.html
target=site.data.variables.default.page.show_author_profile
source0=layout.show_author_profile source1=page.show_author_profile -%}
{%- assign _show_author_profile = __return -%}

{%- include snippets/assign.html
target=site.data.variables.default.page.license
source0=layout.license source1=page.license -%}
{%- assign _license = __return -%}

<div class="layout--article">
{%- include article/top/custom.html -%}

<div class="article__content" itemprop="articleBody">{{ content }}</div>

{%- if _sharing != false -%}
{%- if _sharing -%}
<section class="article__sharing d-print-none">{%- include sharing.html -%}</section>
{%- endif -%}

<footer class="article__footer">
{%- if page.modify_date -%}
{%- include snippets/locale-to-string.html locale=site.data.locale.ARTICLE_DATE_FORMAT -%}
{%- assign _locale_date_format = __return -%}

{%- include snippets/locale-to-string.html locale=site.data.locale.LAST_UPDATED -%}
{%- assign _locale_last_update = __return -%}
<span>{{ _locale_last_update }}
<time itemprop="dateModified" datetime="{{ page.modify_date | date_to_xmlschema }}">{{ page.modify_date | date: _locale_date_format }}</time>
</span>
{%- elsif page.date -%}
<meta itemprop="dateModified" content="{{ page.date | date_to_xmlschema }}">
{%- endif -%}
{%- include article/footer/custom.html -%}

{%- if _show_author_profile -%}
{%- if page.author -%}
{%- assign _author = site.data.authors[page.author] -%}
{%- else -%}
{%- assign _author = site.author -%}
{%- endif -%}
{%- include article/footer/author-profile.html author=_author -%}
{%- endif -%}

{%- if _license != false -%}
{%- assign _data_license = site.data.licenses-%}
{%- if site.license -%}
{%- assign _license_data = _data_license[site.license] -%}
{%- endif -%}
{%- if _license != true -%}
{%- assign _license_data = _data_license[_license] -%}
{%- endif -%}
<div class="article__license">
{%- include article/footer/license.html license=_license_data -%}
</div>
{%- endif -%}
</footer>

<div class="d-print-none">
{%- include article-section-navigator.html -%}
{%- include article-footer.html -%}
{%- include article-section-navigator.html -%}
</div>

</div>
Expand Down
1 change: 0 additions & 1 deletion _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
<div class="{{ _page_main_class }} cell cell--auto">

<div class="page__main-inner">
<div></div>
{%- if _header != false -%}
<div class="page__header d-print-none">
{%- assign _header_theme = page.header.theme | default: layout.header.theme -%}
Expand Down
3 changes: 1 addition & 2 deletions _sass/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ $layout: (
content-max-width: 950px,
sidebar-width: 250px,
sidebar-header-height: 3rem,
aside-width: 220px,
footer-height: 10rem
aside-width: 220px
);

// sm md lg
Expand Down
17 changes: 17 additions & 0 deletions _sass/components/_article-footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.article__footer {
margin: map-get($spacers, 4) 0;
font-size: map-get($base, font-size-sm);
}

.article__license, .article__subscribe {
a {
@include link-colors($text-color, $main-color-1);
}
}

.article__license {
color: $text-color-l;
img {
height: map-get($base, font-size) * 1.6;
}
}
3 changes: 0 additions & 3 deletions _sass/components/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.footer {
@include flexbox();
@include align-items(center);
height: map-get($layout, footer-height);
background: $footer-background;
p {
color: $footer-text-color;
Expand All @@ -14,7 +13,6 @@
@include link-colors ($footer-text-color, $main-color-1);
}
.site-info {
margin: map-get($spacers, 3) auto 0 auto;
font-size: map-get($base, font-size-xs);
text-align: center;
.menu {
Expand All @@ -32,7 +30,6 @@
.footer__author-links {
@include overflow(auto);
.author-links {
padding-top: map-get($spacers, 3);
text-align: center;
}
}
63 changes: 24 additions & 39 deletions _sass/layout/_article.scss
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
.layout--article {
.article__sharing {
margin: map-get($spacers, 4) 0;
}
.article__footer {
margin: map-get($spacers, 4) 0;
font-size: map-get($base, font-size-sm);
.article__license {
.article__sharing {
margin: map-get($spacers, 4) 0;
}
.article__section-navigator {
padding-top: map-get($spacers, 3);
margin: map-get($spacers, 4) 0 map-get($spacers, 3) 0;
word-wrap: break-word;
@include split-line(top, 4px);
& > .previous, & > .next {
width: 50%;
& > span {
font-weight: map-get($base, font-weight-bold);
color: $text-color-l;
img {
height: map-get($base, font-size) * 1.6;
}
a {
@include link-colors($text-color, $main-color-1);
}
}
}
.article__section-navigator {
padding-top: map-get($spacers, 3);
margin: map-get($spacers, 4) 0 map-get($spacers, 3) 0;
word-wrap: break-word;
@include split-line(top, 4px);
& > .previous, & > .next {
width: 50%;
& > span {
font-weight: map-get($base, font-weight-bold);
color: $text-color-l;
}
& > a {
display: block;
@include link-colors($text-color, $main-color-1);
}
}
& > .previous {
float: left;
padding-right: map-get($spacers, 2);
}
& > .next {
float: right;
padding-left: map-get($spacers, 2);
text-align: right;
& > a {
display: block;
@include link-colors($text-color, $main-color-1);
}
}
& > .previous {
float: left;
padding-right: map-get($spacers, 2);
}
& > .next {
float: right;
padding-left: map-get($spacers, 2);
text-align: right;
}
}
Loading

0 comments on commit 34d7fe1

Please sign in to comment.