Skip to content

Commit

Permalink
Extract some features to plugins (#1232)
Browse files Browse the repository at this point in the history
* Remove wechat_subscriber

* Remove custom_scrollbar

* Remove facebook & vk
  • Loading branch information
stevenjoezhang committed Oct 28, 2019
1 parent 611fc71 commit 5c82ba3
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 262 deletions.
77 changes: 11 additions & 66 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ scheme: Muse

# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-senstive.
# Value before `||` delimiter is the target link.
# Value after `||` delimiter is the name of Font Awesome icon. If icon (with or without delimiter) is not specified, question icon will be loaded.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# When running the site in a subdirectory (e.g. domain.tld/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https://
menu:
Expand Down Expand Up @@ -169,9 +168,7 @@ sidebar:

# Sidebar Avatar
avatar:
# In theme directory (source/images): /images/avatar.gif
# In site directory (source/uploads): /uploads/avatar.gif
# You can also use other linking images.
# Replace the default image and set the url here.
url: #/images/avatar.gif
# If true, the avatar would be dispalyed in circle.
rounded: false
Expand All @@ -184,8 +181,7 @@ site_state: true
# Social Links
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimiter is the target permalink.
# Value after `||` delimiter is the name of Font Awesome icon. If icon (with or without delimiter) is not specified, globe icon will be loaded.
# Value before `||` delimiter is the target permalink, value after `||` delimiter is the name of Font Awesome icon.
social:
#GitHub: https://github.com/yourname || github
#E-Mail: mailto:yourname@gmail.com || envelope
Expand Down Expand Up @@ -241,9 +237,6 @@ chat:
# See: https://theme-next.org/docs/theme-settings/posts
# ---------------------------------------------------------------

# Automatically scroll page to section which is under <!-- more --> mark.
scroll_to_more: true

# Automatically excerpt description in homepage as preamble text.
excerpt_description: true

Expand Down Expand Up @@ -278,12 +271,6 @@ symbols_count_time:
# Use icon instead of the symbol # to indicate the tag at the bottom of the post
tag_icon: false

# Wechat Subscriber
wechat_subscriber:
enable: false
qcode: #/uploads/wechat-qcode.jpg
#description: Subscribe to my blog by scanning my public wechat account.

# Reward (Donate)
reward_settings:
# If true, reward would be displayed in every article by default.
Expand Down Expand Up @@ -328,7 +315,7 @@ cheers: true

# TagCloud settings for tags page.
tagcloud:
# All values below are same as default, change them by yourself
# All values below are same as default, change them by yourself.
min: 12 # Minimun font size in px
max: 30 # Maxium font size in px
start: "#ccc" # Start color (hex, rgba, hsla or color keywords)
Expand All @@ -337,9 +324,6 @@ tagcloud:

# Google Calendar
# Share your recent schedule to others via calendar page.
# API Documentation: https://developers.google.com/google-apps/calendar/v3/reference/events/list
# To get api_key: https://console.developers.google.com
# Create & manage a public Google calendar: https://support.google.com/calendar/answer/37083
calendar:
calendar_id: <required> # Your Google account E-Mail
api_key: <required>
Expand Down Expand Up @@ -370,9 +354,6 @@ android_chrome_color: "#222"
# Hide sticky headers and color the menu bar on Safari (iOS / macOS).
safari_rainbow: false

# Optimize the display of scrollbars on webkit based browsers.
custom_scrollbar: false

# Custom Logo (Do not support scheme Mist)
custom_logo: #/uploads/custom-logo.jpg

Expand Down Expand Up @@ -526,8 +507,6 @@ baidu_push: false

# Math Formulas Render Support
math:
enable: false

# Default (true) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in Front-matter.
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
Expand Down Expand Up @@ -600,7 +579,7 @@ comments:
# Available values: tabs | buttons
style: tabs
# Choose a comment system to be displayed by default.
# Available values: changyan | disqus | disqusjs | facebook_comments_plugin | gitalk | livere | valine | vkontakte
# Available values: changyan | disqus | disqusjs | gitalk | livere | valine
active:
# Setting `true` means remembering the comment system selected by the visitor.
storage: true
Expand All @@ -609,8 +588,6 @@ comments:
#disqus:
# text: Load Disqus
# order: -1
#facebook_comments_plugin:
# text: <i class="fa fa-facebook-official" aria-hidden="true"></i> facebook
#gitalk:
# order: -2

Expand Down Expand Up @@ -690,33 +667,6 @@ gitalk:
# See: https://theme-next.org/docs/third-party-services/post-widgets
# ---------------------------------------------------------------

# Facebook SDK Support
facebook_sdk:
enable: false
app_id: # <app_id>
fb_admin: # <user_id>
like_button: # true
webmaster: # true

# Facebook comments plugin
# This plugin depends on Facebook SDK.
# If facebook_sdk.enable is false, Facebook comments plugin is unavailable.
facebook_comments_plugin:
enable: false
num_of_posts: 10 # Minimum posts num is 1
width: 100% # Default width is 550px
scheme: light # Default scheme is light (light or dark)
#post_meta_order: 0

# VKontakte API Support
# To get your AppID visit https://vk.com/editapp?act=create
vkontakte_api:
enable: false
app_id: # <app_id>
like: true
comments: true
num_of_posts: 10

# Star rating support to each article.
# To get your ID visit https://widgetpack.com
rating:
Expand All @@ -734,13 +684,6 @@ add_this_id:
# See: https://theme-next.org/docs/third-party-services/statistics-and-analytics
# ---------------------------------------------------------------

# Baidu Analytics
baidu_analytics: # <app_id>

# Growingio Analytics
# Copyright 2015-2018 GrowingIO, Inc. More info available at https://www.growingio.com
growingio_analytics: # <project_id>

# Google Analytics
google_analytics:
tracking_id: # <app_id>
Expand All @@ -749,13 +692,15 @@ google_analytics:
# If you only need the pageview feature, set the following option to true to get a better performance.
only_pageview: false

# Baidu Analytics
baidu_analytics: # <app_id>

# Growingio Analytics
growingio_analytics: # <project_id>

# CNZZ count
cnzz_siteid:

# Application Insights
# See: https://azure.microsoft.com/en-us/services/application-insights
application_insights:

# Show number of visitors to each article.
# You can visit https://leancloud.cn to get AppID and AppKey.
leancloud_visitors:
Expand Down
1 change: 0 additions & 1 deletion layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

{% include '_third-party/math/index.swig' %}
{% include '_third-party/quicklink.swig' %}
{% include '_third-party/vkontakte-api.swig' %}

{{- next_inject('bodyEnd') }}

Expand Down
6 changes: 1 addition & 5 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<!--noindex-->
{%- if theme.read_more_btn %}
<div class="post-button">
<a class="btn" href="{{ url_for(post.path) }}{%- if theme.scroll_to_more %}#more{%- endif %}" rel="contents">
<a class="btn" href="{{ url_for(post.path) }}#more" rel="contents">
{{ __('post.read_more') }} &raquo;
</a>
</div>
Expand All @@ -226,10 +226,6 @@
{%- if not is_index %}
{{- next_inject('postBodyEnd') }}

{%- if theme.wechat_subscriber.enable %}
{{ partial('_partials/post/wechat-subscriber.swig', {}, {cache: theme.cache.enable}) }}
{%- endif %}

{%- if post.reward === undefined and theme.reward_settings.enable %}
{%- set reward_able = true %}
{% else %}
Expand Down
5 changes: 0 additions & 5 deletions layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}">
{%- endif %}

{%- if theme.facebook_sdk.enable and theme.facebook_sdk.webmaster %}
<meta property="fb:admins" content="{{ theme.facebook_sdk.fb_admin }}">
<meta property="fb:app_id" content="{{ theme.facebook_sdk.app_id }}">
{%- endif %}

<link rel="stylesheet" href="{{ url_for(theme.css) }}/main.css">

{{ next_font() }}
Expand Down
20 changes: 1 addition & 19 deletions layout/_partials/post/post-footer.swig
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
{%- if theme.rating.enable or (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
{%- if theme.rating.enable %}
<div class="post-widgets">
{%- if theme.rating.enable %}
<div class="wp_rating">
<div id="wpac-rating"></div>
</div>
{%- endif %}

{%- if (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
<div class="social-like">
{%- if theme.vkontakte_api.enable and theme.vkontakte_api.like %}
<div class="vk_like">
<span id="vk_like"></span>
</div>
{%- endif %}

{%- if theme.facebook_sdk.enable and theme.facebook_sdk.like_button %}
<div class="fb_like">
<div class="fb-like" data-layout="button_count" data-share="true"></div>
</div>
{%- endif %}
</div>
{%- endif %}
</div>
{%- endif %}
4 changes: 0 additions & 4 deletions layout/_partials/post/wechat-subscriber.swig

This file was deleted.

11 changes: 0 additions & 11 deletions layout/_third-party/analytics/application-insights.swig

This file was deleted.

1 change: 0 additions & 1 deletion layout/_third-party/analytics/index.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% include 'google-analytics.swig' %}
{% include 'baidu-analytics.swig' %}
{% include 'application-insights.swig' %}
{% include 'growingio.swig' %}
18 changes: 0 additions & 18 deletions layout/_third-party/facebook-sdk.swig

This file was deleted.

1 change: 0 additions & 1 deletion layout/_third-party/index.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% include 'baidu-push.swig' %}

{% include 'facebook-sdk.swig' %}
{% include 'rating.swig' %}

{%- if theme.algolia_search.enable %}
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/math/index.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if theme.math.enable %}
{%- if theme.math.mathjax.enable or theme.math.katex.enable %}
{%- set is_index_has_math = false %}

{# At home, check if there has `mathjax: true` post #}
Expand Down
27 changes: 0 additions & 27 deletions layout/_third-party/vkontakte-api.swig

This file was deleted.

44 changes: 0 additions & 44 deletions scripts/filters/comment/facebook-comments-plugin.js

This file was deleted.

15 changes: 0 additions & 15 deletions scripts/filters/comment/vkontakte.js

This file was deleted.

2 changes: 0 additions & 2 deletions source/css/_common/components/components.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
@import 'third-party';

@import 'rainbow' if (hexo-config('safari_rainbow'));

@import 'scrollbar' if (hexo-config('custom_scrollbar'));
Loading

1 comment on commit 5c82ba3

@andrewintw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevenjoezhang why delete the fb comment feature?

Please sign in to comment.