惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
H
Heimdal Security Blog
Help Net Security
Help Net Security
H
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
The GitHub Blog
The GitHub Blog
博客园_首页
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - 【当耐特】
J
Java Code Geeks
S
SegmentFault 最新的问题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
O
OpenAI News
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
B
Blog RSS Feed
V2EX - 技术
V2EX - 技术
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tenable Blog
PCI Perspectives
PCI Perspectives
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
Schneier on Security
Schneier on Security
Google Online Security Blog
Google Online Security Blog
美团技术团队
G
GRAHAM CLULEY
D
DataBreaches.Net
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
W
WeLiveSecurity
Vercel News
Vercel News
S
Security Affairs
T
Tailwind CSS Blog
V
Vulnerabilities – Threatpost
博客园 - 司徒正美
G
Google Developers Blog
D
Docker
Webroot Blog
Webroot Blog

Icarus

Getting Started with Icarus Icarus User Guide - Configuring the Theme FAQ Cyberpunk Theme Variant Upgrade Guide Custom Hexo Tag Helpers 自定义Hexo标签插件 Hexo Built-in Tag Helpers Icarus User Guide - CDN Providers Icarus User Guide - Comment Plugins Icarus User Guide - Donation Buttons Icarus User Guide - Other Plugins Icarus User Guide - Search Plugin Icarus User Guide - Web Analytics Plugins Icarus User Guide - Widgets Icarus快速上手 Icarus用户指南 - 主题配置 常见问题 升级指南
Icarus User Guide - Share Buttons
PPOffice · 2017-01-31 · via Icarus

This article covers share buttons supported by Icarus 5.

The following share buttons are provided by ppoffice/hexo-component-inferno. Please refer to it for a complete list of supported plugins and their configuration details.

AddThis

Some AD blockers may block this share button service. Use it with caution.

The Baidu share button service is no longer available. Use other services as alternatives.

  1. Register for AddThis. Select the “Share Buttons” on the “Select a Tool” page after submitting the registration form.

    Select Tool - AddThis
  2. Select the style and buttons on the “Select a Tool Type” page and click “Continue”.

    Select Tool Type - AddThis
  3. Make further customizations on the next page and click the “Activate Tool” button when finished.

    Customize Share Buttons - AddThis
  4. Find the HTML code from the “Get The Code” page, copy the URL in the src attribute to the share button configuration.

    Get Code - AddThis

    For example, the URL in the following AddThis code:

    AddThis Code
    1
    2

    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-xxxxxxxxxxxxx"></script>

    maps to the following theme configuration:

    _config.icarus.yml
    1
    2
    3
    share:
    type: addthis
    install_url: //s7.addthis.com/js/300/addthis_widget.js#pubid=ra-xxxxxxxxxxxxx

AddToAny

  1. You can activate AddToAny without user registration. Just put the following code to your theme configurations:

    _config.icarus.yml
    1
    2
    share:
    type: addtoany

Take the following steps if you want to customize the share buttons:

  1. Visit AddToAny official site and click on the “Get the Share Button”.

  2. Then, select “Any Website” and complete the configuration of the buttons.

    Select Platform - AddToAny
  3. Click “Get Button Code” after you finish.

    Get Code - AddToAny
  4. Since the share buttons of Icarus is provided by ppoffice/hexo-component-inferno, you need to copy the layout file (src/view/share/addtoany.jsx) of AddToAny from this repository to <icarus_directory>/layout/share/addtoany.jsx. Then, replace the AddToAny code in addtoany.jsx and fix the package import in the file header.

    For example, assume the following code is what you get from the last step:

    AddToAny Code >folded
    1
    2
    3
    4
    5
    6
    7
    8
    9

    <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
    <a class="a2a_dd" href="https://www.addtoany.com/share"></a>
    <a class="a2a_button_facebook"></a>
    <a class="a2a_button_twitter"></a>
    <a class="a2a_button_email"></a>
    </div>
    <script async src="https://static.addtoany.com/menu/page.js"></script>

    then you should make the following changes to addtoany.jsx:

    <icarus_directory>/layout/share/addtoany.jsx >folded
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    const { Component, Fragment } = require('inferno');
    - const { cacheComponent } = require('../../util/cache');
    + const { cacheComponent } = require('hexo-component-inferno/lib/util/cache');

    ...Some code is skipped here...

    class AddToAny extends Component {
    render() {
    return <Fragment>
    - <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
    - <a class="a2a_dd" href="https://www.addtoany.com/share"></a>
    - <a class="a2a_button_facebook"></a>
    - <a class="a2a_button_twitter"></a>
    - <a class="a2a_button_telegram"></a>
    - <a class="a2a_button_whatsapp"></a>
    - <a class="a2a_button_reddit"></a>
    - </div>
    - <script src="https://static.addtoany.com/menu/page.js" defer={true}></script>
    + <!-- AddToAny HTML code you just got... -->
    + <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
    + <a class="a2a_dd" href="https://www.addtoany.com/share"></a>
    + <a class="a2a_button_facebook"></a>
    + <a class="a2a_button_twitter"></a>
    + <a class="a2a_button_email"></a>
    + </div>
    + <script async src="https://static.addtoany.com/menu/page.js"></script>
    </Fragment>;
    }
    }

    ...The following code is skipped here...

Some AD blockers may block this share button service. Use it with caution.

The Baidu share button service seems to be no longer maintained. Use other services as alternatives.

Installation Guide

  1. You can activate Baidu Share without user registration. Just put the following code to your theme configurations:

    _config.icarus.yml
    1
    2
    share:
    type: bdshare

The Share.js button service is no longer maintained. Use other services as alternatives.

  1. You can activate Share.js without user registration. Just put the following code to your theme configurations:

    _config.icarus.yml
    1
    2
    share:
    type: sharejs
  2. (Optional) Please refer to the customization steps in the AddToAny section and the share.js homepage for information about customizing the share buttons.

  1. Visit ShareThis and click the “Start with Share Buttons” button on the page.

  2. Select the type of buttons you need on the “Choose type of sharing button” page. Don’t enable the “GDPR compliance tool” since it may cause issues. You can also make advanced adjustments by clicking the “Customize your share buttons” link. Click “Next” when you are done.

    Choose Button Type - ShareThis
  3. Select “HTML” on the “Choose your CMS platform” page and click “Next”.

    Choose Platform - ShareThis
  4. Enter your email and password to finish the registration for ShareThis on the “Register and get the code!” page.

  5. Finally, copy the src URL from the HTML code fragment to the share button configuration.

    Get Code - ShareThis

    For example, the following ShareThis code:

    AddThis Code
    1
    <script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=xxxxxxxxxxxxx&product=inline-share-buttons" async="async"></script>

    maps to the following theme configuration:

    _config.icarus.yml
    1
    2
    3
    share:
    type: sharethis
    install_url: https://platform-api.sharethis.com/js/sharethis.js#property=xxxxxxxxxxxxx&product=inline-share-buttons

Something wrong with this article? Click here to submit your revision.