Skip to content

Commit

Permalink
Merge pull request #463 from theme-next/dev
Browse files Browse the repository at this point in the history
Global improvement for ExtURL & refactored Creative Commons copyright.
  • Loading branch information
ivan-nginx authored Nov 7, 2018
2 parents c68bf23 + 44793b7 commit 2260c04
Show file tree
Hide file tree
Showing 28 changed files with 317 additions and 183 deletions.
64 changes: 28 additions & 36 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,21 @@ footer:
# http://www.miitbeian.gov.cn/
beian:
enable: false
icp:
icp:

# -------------------------------------------------------------
# Any custom text can be defined here.
#custom_text: Hosted by <a target="_blank" rel="external nofollow" href="https://pages.coding.me"><b>Coding Pages</b></a>

# Creative Commons 4.0 International License.
# https://creativecommons.org/share-your-work/licensing-types-examples/
# Available: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
creative_commons:
license: by-nc-sa
sidebar: false
post: false


# ---------------------------------------------------------------
# SEO Settings
# ---------------------------------------------------------------
Expand All @@ -113,6 +122,9 @@ seo: false
# subtitle: Subtitle
index_with_subtitle: false

# Automatically add external URL with BASE64 encrypt & decrypt.
exturl: false


# ---------------------------------------------------------------
# Menu Settings
Expand Down Expand Up @@ -178,10 +190,6 @@ social_icons:
enable: true
icons_only: false
transition: false
# Dependencies: exturl: true in Tags Settings section below.
# To encrypt links above use https://www.base64encode.org
# Example encoded link: `GitHub: aHR0cHM6Ly9naXRodWIuY29tL3RoZW1lLW5leHQ= || github`
exturl: false

# Follow me on GitHub banner in right-top corner.
# Usage: `permalink || title`
Expand Down Expand Up @@ -220,12 +228,6 @@ toc:
# If true, all words will placed on next lines if header width longer then sidebar width.
wrap: false

# Creative Commons 4.0 International License.
# http://creativecommons.org/
# Available: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
#creative_commons: by-nc-sa
#creative_commons:

sidebar:
# Sidebar Position, available value: left | right (only for Pisces | Gemini).
position: left
Expand Down Expand Up @@ -339,11 +341,6 @@ related_posts:
#isImage: false
#isExcerpt: false

# Declare license on posts
post_copyright:
enable: false
license: <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a>

# Post edit
# Dependencies: https://github.com/hexojs/hexo-deployer-git
post_edit:
Expand Down Expand Up @@ -479,10 +476,10 @@ han: false
pangu: false

# Swiftype Search API Key
#swiftype_key:
#swiftype_key:

# Baidu Analytics ID
#baidu_analytics:
#baidu_analytics:

# Growingio Analytics ID
# Copyright 2015-2018 GrowingIO, Inc. More info available at http://www.growingio.com
Expand Down Expand Up @@ -741,11 +738,6 @@ bookmark:
# Tags Settings
# ---------------------------------------------------------------

# External URL with BASE64 encrypt & decrypt.
# Usage: {% exturl text url "title" %}
# Alias: {% extlink text url "title" %}
exturl: false

# Note tag (bs-callout).
note:
# Note tag style values:
Expand Down Expand Up @@ -880,14 +872,14 @@ vendors:
_internal: lib

# Internal version: 2.1.3
# Example:
# Example:
# jquery: //cdn.jsdelivr.net/npm/jquery@2.1.3/dist/jquery.min.js
# jquery: //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
jquery:

# Internal version: 2.1.5
# See: http://fancyapps.com/fancybox/
# Example:
# Example:
# fancybox: //cdn.jsdelivr.net/npm/fancybox@3.0.0/dist/js/jquery.fancybox.pack.js
# fancybox_css: //cdn.jsdelivr.net/npm/fancybox@3.0.0/dist/css/jquery.fancybox.min.css
# fancybox: //cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.js
Expand All @@ -897,7 +889,7 @@ vendors:

# Internal version: 1.0.6
# See: https://github.com/ftlabs/fastclick
# Example:
# Example:
# fastclick: //cdn.jsdelivr.net/npm/fastclick@1.0.6/lib/fastclick.min.js
fastclick:

Expand All @@ -908,7 +900,7 @@ vendors:

# Internal version: 1.2.1
# See: http://VelocityJS.org
# Example:
# Example:
# velocity: https://cdn.jsdelivr.net/npm/velocity-animate@1.2.1/velocity.min.js
# velocity: https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.1/velocity.min.js
velocity:
Expand All @@ -921,29 +913,29 @@ vendors:

# Internal version: 0.7.9
# See: https://faisalman.github.io/ua-parser-js/
# Example:
# Example:
# ua_parser: //cdn.jsdelivr.net/npm/ua-parser-js@0.7.17/src/ua-parser.min.js
# ua_parser: //cdnjs.cloudflare.com/ajax/libs/UAParser.js/0.7.9/ua-parser.min.js
ua_parser:

# Internal version: 4.6.2
# See: http://fontawesome.io/
# Example:
# Example:
# fontawesome: //cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css
# fontawesome: //cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.2/css/font-awesome.min.css
fontawesome:

# Internal version: 1
# https://www.algolia.com
# Example:
# Example:
# algolia_instant_js: //cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.js
# algolia_instant_css: //cdn.jsdelivr.net/npm/instantsearch.js@2.4.1/dist/instantsearch.min.css
algolia_instant_js:
algolia_instant_css:

# Internal version: 1.0.2
# See: https://github.com/HubSpot/pace
# Example:
# Example:
# pace: //cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js
# pace: //cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js
# pace_css: //cdn.jsdelivr.net/npm/pace-js@1.0.2/themes/blue/pace-theme-minimal.css
Expand All @@ -958,7 +950,7 @@ vendors:

# Internal version: 1.0.0
# See: https://github.com/theme-next/theme-next-three
# Example:
# Example:
# three: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@1.0.0/three.min.js
# three_waves: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@1.0.0/three-waves.min.js
# canvas_lines: //cdn.jsdelivr.net/gh/theme-next/theme-next-three@1.0.0/canvas_lines.min.js
Expand All @@ -978,14 +970,14 @@ vendors:

# Internal version: 3.3.0
# https://github.com/vinta/pangu.js
# Example:
# Example:
# pangu: //cdn.jsdelivr.net/npm/pangu@3.3.0/dist/browser/pangu.min.js
# pangu: //cdnjs.cloudflare.com/ajax/libs/pangu/3.3.0/pangu.min.js
pangu:

# needMoreShare2
# https://github.com/revir/need-more-share2
# Example:
# Example:
# needmoreshare2_js: //cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1.0.0/needsharebutton.min.js
# needmoreshare2_css: //cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1.0.0/needsharebutton.min.css
needmoreshare2_js:
Expand All @@ -994,14 +986,14 @@ vendors:
# bookmark
# Internal version: 1.0.0
# https://github.com/theme-next/theme-next-bookmark
# Example:
# Example:
# bookmark: //cdn.jsdelivr.net/gh/theme-next/theme-next-bookmark@1.0.0/bookmark.min.js
bookmark:

# reading_progress
# Internal version: 1.0
# https://github.com/theme-next/theme-next-reading-progress
# Example:
# Example:
# reading_progress: //cdn.jsdelivr.net/gh/theme-next/theme-next-reading-progress@1.1/reading_progress.min.js
reading_progress:

Expand Down
19 changes: 10 additions & 9 deletions layout/_macro/menu/menu-item.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@

{% set itemURL = value.split('||')[0] | replace('//', '/', 'g') | trim %}
<li class="menu-item menu-item-{{ itemName | replace(' ', '-', 'g') }}{{ item_active(itemURL, 'menu-item-active') }}">
<a href="{{ url_for(itemURL) }}" rel="section">
{%- if theme.menu_settings.icons %}
<i class="menu-item-icon fa fa-fw fa-{{ value.split('||')[1] | trim | default('question-circle') }}"></i> <br />{#
#}{% endif %}

{{- __('menu.' + name ) | replace('menu.', '') -}}
{% set menuText = __('menu.' + name ) | replace('menu.', '') %}
{% set menuURL = itemURL %}
{% if theme.menu_settings.icons %}
{% set menuIcon = '<i class="menu-item-icon fa fa-fw fa-' + value.split('||')[1] | trim | default('question-circle') + '"></i> <br />' %}
{% endif %}

{%- if theme.menu_settings.badges -%}
{{- menu_badge.render(name) | trim -}}
{%- endif -%}
{% if theme.menu_settings.badges %}
{% set menuBadge = menu_badge.render(name) | trim %}
{% endif %}

{{ next_url(menuURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}

</a>
</li>

{% endmacro %}
6 changes: 2 additions & 4 deletions layout/_macro/post-collapse.swig
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

<{% if theme.seo %}h3{% else %}h2{% endif %} class="post-title">
{% if post.link %}{# Link posts #}
<a class="post-title-link post-title-link-external" target="_blank" href="{{ url_for(post.link) }}" itemprop="url">
{{ post.title or post.link }}
<i class="fa fa-external-link"></i>
</a>
{% set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{{ next_url(url_for(post.link), (post.title or post.link) + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% else %}
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
{% if post.type === 'picture' %}
Expand Down
14 changes: 0 additions & 14 deletions layout/_macro/post-copyright.swig

This file was deleted.

20 changes: 8 additions & 12 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,22 @@
<i class="fa fa-thumb-tack"></i>
</span>
{% endif %}
<a class="post-title-link post-title-link-external" target="_blank" href="{{ url_for(post.link) }}" itemprop="url">
{{ post.title or post.link }}
<i class="fa fa-external-link"></i>
</a>
{% set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{{ next_url(url_for(post.link), (post.title or post.link) + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% else %}{#
#}{% if is_index %}
{% if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
</span>
{% endif %}
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
{{ post.title | default(__('post.untitled'))}}
</a>
{# Need to delete maybe? #}
{{ next_url(url_for(post.path), post.title | default(__('post.untitled')), {class: 'post-title-link', itemprop: url }) }}
{% else -%}
{{- post.title -}}
{% if theme.post_edit.enable -%}
<a href="{{ theme.post_edit.url }}{{ post.source.slice(7) }}" class="post-edit-link" title="{{ __('post.edit') }}" target="_blank">
<i class="fa fa-pencil"></i>
</a>
{% set editIcon = '<i class="fa fa-pencil"></i>' -%}
{{ next_url(theme.post_edit.url + post.source.slice(7), editIcon, {class: 'post-edit-link', title: __('post.edit') }) }}
{%- endif %}
{% endif %}
{% endif %}
Expand Down Expand Up @@ -369,9 +365,9 @@
</div>
{% endif %}

{% if theme.post_copyright.enable and not is_index %}
{% if theme.creative_commons.license and theme.creative_commons.post and not is_index %}
<div>
{% include 'post-copyright.swig' with { post: post } %}
{% include '../_partials/post-copyright.swig' with { post: post } %}
</div>
{% endif %}

Expand Down
44 changes: 20 additions & 24 deletions layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,30 @@
<div class="links-of-author motion-element">
{% for name, link in theme.social %}
<span class="links-of-author-item">
{% if theme.exturl && theme.social_icons.exturl %}
<span class="exturl" data-url="{{ link.split('||')[0] | trim }}" title="{{ name }}">{#
#}{% else %}{#
#}<a href="{{ link.split('||')[0] | trim }}" target="_blank" title="{{ name }}"{% if theme.seo %} rel="external nofollow"{% endif %}>{#
#}{% endif %}{#
#}{% if theme.social_icons.enable %}{#
#}<i class="fa fa-fw fa-{{ link.split('||')[1] | trim | default('globe') }}"></i>{#
#}{% endif %}{#
#}{% if not theme.social_icons.icons_only %}{#
#}{{ name }}{#
#}{% endif %}{#
#}{% if theme.exturl && theme.social_icons.exturl %}{#
#}</span>
{% else %}{#
#}</a>
{% set sidebarURL = link.split('||')[0] | trim %}
{% if not (theme.social_icons.enable) or (not theme.social_icons.icons_only) %}
{% set sidebarText = name %}
{% endif %}
{% if theme.social_icons.enable %}
{% set sidebarIcon = '<i class="fa fa-fw fa-' + link.split('||')[1] | trim | default('globe') + '"></i>' %}
{% endif %}
{{ next_url(sidebarURL, sidebarIcon + sidebarText, {title: name + ' &rarr; ' + sidebarURL}) }}
</span>
{% endfor %}
</div>
{% endif %}

{% set cc = {'by': 1, 'by-nc': 1, 'by-nc-nd': 1, 'by-nc-sa': 1, 'by-nd': 1, 'by-sa': 1, 'zero': 1} %}
{% if theme.creative_commons in cc %}
<div class="cc-license motion-element" itemprop="license">
<a href="https://creativecommons.org/{% if theme.creative_commons === 'zero' %}publicdomain/zero/1.0{% else %}licenses/{{ theme.creative_commons }}/4.0{% endif %}/" class="cc-opacity" target="_blank"{% if theme.seo %} rel="external nofollow"{% endif %}>
<img src="{{ url_for(theme.images) }}/cc-{{ theme.creative_commons }}.svg" alt="Creative Commons" />
</a>
</div>
{% if theme.creative_commons.license and theme.creative_commons.sidebar %}
<div class="cc-license motion-element" itemprop="license">
{% if theme.creative_commons.license === 'zero' %}
{% set ccType = 'publicdomain/zero/1.0/' %}
{% else %}
{% set ccType = 'licenses/' + theme.creative_commons.license + '/4.0/' %}
{% endif %}
{% set ccURL = 'https://creativecommons.org/' + ccType %}
{% set ccImage = '<img src="' + url_for(theme.images) + '/cc-' + theme.creative_commons.license + '.svg" alt="Creative Commons" />' %}
{{ next_url(ccURL, ccImage, {class: 'cc-opacity'}) }}
</div>
{% endif %}

{# Blogroll #}
Expand All @@ -138,9 +134,9 @@
{{ theme.links_title }}
</div>
<ul class="links-of-blogroll-list">
{% for name, link in theme.links %}
{% for blogrollText, blogrollURL in theme.links %}
<li class="links-of-blogroll-item">
<a href="{{ link }}" title="{{ name }}" target="_blank">{{ name }}</a>
{{ next_url(blogrollURL, blogrollText, {title: blogrollURL}) }}
</li>
{% endfor %}
</ul>
Expand Down
7 changes: 3 additions & 4 deletions layout/_partials/comments.swig
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
{% elseif theme.disqus.enable %}
<div class="comments" id="comments">
<div id="disqus_thread">
<noscript>
Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
<noscript>{#
#}Please enable JavaScript to view the comments powered by Disqus.{#
#}</noscript>
</div>
</div>

Expand Down
Loading

0 comments on commit 2260c04

Please sign in to comment.