Skip to content

Commit

Permalink
Migrate to Font Awesome 5 (theme-next#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Apr 1, 2020
1 parent f995680 commit e61c2e0
Show file tree
Hide file tree
Showing 35 changed files with 73 additions and 2,557 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ node_modules/
source/lib/*

# Track internal libraries & Ignore unused verdors files
source/lib/font-awesome/less/
source/lib/font-awesome/scss/
!source/lib/font-awesome/

!source/lib/anime.min.js

!source/lib/velocity/
62 changes: 31 additions & 31 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ footer:
icon:
# Icon name in Font Awesome. See: https://fontawesome.com/v4.7.0/icons/
# `heart` is recommended with animation in red (#ff0000).
name: user
name: fa fa-user
# If you want to animate the icon, set it to true.
animated: false
# Change the color of icon, using Hex Code.
Expand Down Expand Up @@ -117,14 +117,14 @@ darkmode: false
# When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https://
menu:
home: / || home
#about: /about/ || user
#tags: /tags/ || tags
#categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
home: / || fa fa-home
#about: /about/ || fa fa-user
#tags: /tags/ || fa fa-tags
#categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
#schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat

# Enable / Disable menu icons / item badges.
menu_settings:
Expand Down Expand Up @@ -178,16 +178,16 @@ site_state: true
# 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.
social:
#GitHub: https://github.com/yourname || github
#E-Mail: mailto:[email protected] || envelope
#Weibo: https://weibo.com/yourname || weibo
#Google: https://plus.google.com/yourname || google
#Twitter: https://twitter.com/yourname || twitter
#FB Page: https://www.facebook.com/yourname || facebook
#StackOverflow: https://stackoverflow.com/yourname || stack-overflow
#YouTube: https://youtube.com/yourname || youtube
#Instagram: https://instagram.com/yourname || instagram
#Skype: skype:yourname?call|chat || skype
#GitHub: https://github.com/yourname || fab fa-github
#E-Mail: mailto:[email protected] || fa fa-envelope
#Weibo: https://weibo.com/yourname || fab fa-weibo
#Google: https://plus.google.com/yourname || fab fa-google
#Twitter: https://twitter.com/yourname || fab fa-twitter
#FB Page: https://www.facebook.com/yourname || fab fa-facebook
#StackOverflow: https://stackoverflow.com/yourname || fab fa-stack-overflow
#YouTube: https://youtube.com/yourname || fab fa-youtube
#Instagram: https://instagram.com/yourname || fab fa-instagram
#Skype: skype:yourname?call|chat || fab fa-skype

social_icons:
enable: true
Expand All @@ -196,7 +196,7 @@ social_icons:

# Blog rolls
links_settings:
icon: link
icon: fa fa-link
title: Links
# Available values: block | inline
layout: block
Expand All @@ -223,7 +223,7 @@ chat:
enable: false
#service: chatra
#service: tidio
icon: comment # Icon name in Font Awesome, set false to disable icon.
icon: fa fa-comment # Icon name in Font Awesome, set false to disable icon.
text: Chat # Button text, change it as you wish.


Expand Down Expand Up @@ -275,10 +275,10 @@ reward:
# Subscribe through Telegram Channel, Twitter, etc.
# Usage: `Key: permalink || icon` (Font Awesome)
follow_me:
#Twitter: https://twitter.com/username || twitter
#Telegram: https://t.me/channel_name || telegram
#WeChat: /images/wechat_channel.jpg || wechat
#RSS: /atom.xml || rss
#Twitter: https://twitter.com/username || fab fa-twitter
#Telegram: https://t.me/channel_name || fab fa-telegram
#WeChat: /images/wechat_channel.jpg || fab fa-weixin
#RSS: /atom.xml || fa fa-rss

# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
Expand Down Expand Up @@ -714,11 +714,11 @@ firestore:
busuanzi_count:
enable: false
total_visitors: true
total_visitors_icon: user
total_visitors_icon: fa fa-user
total_views: true
total_views_icon: eye
total_views_icon: fa fa-eye
post_views: true
post_views_icon: eye
post_views_icon: fa fa-eye


# ---------------------------------------------------------------
Expand Down Expand Up @@ -886,9 +886,9 @@ vendors:
# anime: //cdn.jsdelivr.net/npm/[email protected]/lib/anime.min.js
anime:

# Internal version: 4.7.0
# fontawesome: //cdn.jsdelivr.net/npm/font-awesome@4/css/font-awesome.min.css
# fontawesome: //cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css
# Internal version: 5.13.0
# fontawesome: //cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css
# fontawesome: //cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css
fontawesome:

# MathJax
Expand Down
2 changes: 1 addition & 1 deletion layout/_macro/post-collapse.swig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<div class="post-title">
{%- if post.link %}{# Link posts #}
{%- set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{%- set postTitleIcon = '<i class="fa fa-external-link-alt"></i>' %}
{%- set postText = post.title or post.link %}
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url'}) }}
{% else %}
Expand Down
18 changes: 9 additions & 9 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
{%- if post.link %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
<i class="fa fa-thumbtack"></i>
</span>
{%- endif %}
{%- set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{%- set postTitleIcon = '<i class="fa fa-external-link-alt"></i>' %}
{%- set postText = post.title or post.link %}
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url'}) }}
{% elif is_index %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
<i class="fa fa-thumbtack"></i>
</span>
{%- endif %}
{{ next_url(post.path, post.title or __('post.untitled'), {class: 'post-title-link', itemprop: 'url'}) }}
Expand All @@ -49,7 +49,7 @@
{%- if theme.post_meta.created_at %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">{{ __('post.posted') }}</span>

Expand All @@ -69,7 +69,7 @@
{%- if display_updated or not theme.post_meta.created_at %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">{{ __('post.edited') }}</span>
<time title="{{ __('post.modified') + __('symbol.colon') + full_date(post.updated) }}" itemprop="dateModified" datetime="{{ moment(post.updated).format() }}">{{ date(post.updated) }}</time>
Expand All @@ -80,7 +80,7 @@
{%- if post.categories and post.categories.length and theme.post_meta.categories %}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">{{ __('post.in') }}</span>
{%- for cat in post.categories.toArray() %}
Expand Down Expand Up @@ -120,7 +120,7 @@
{%- if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.post_views %}
<span class="post-meta-item" title="{{ __('post.views') }}" id="busuanzi_container_page_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.post_views_icon }}"></i>
<i class="{{ theme.busuanzi_count.post_views_icon }}"></i>
</span>
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
<span id="busuanzi_value_page_pv"></span>
Expand All @@ -133,7 +133,7 @@
{%- if theme.symbols_count_time.separated_meta %}<br>{%- endif %}
<span class="post-meta-item" title="{{ __('symbols_count_time.count') }}">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
<i class="far fa-file-word"></i>
</span>
{%- if theme.symbols_count_time.item_text_post %}
<span class="post-meta-item-text">{{ __('symbols_count_time.count') + __('symbol.colon') }}</span>
Expand All @@ -145,7 +145,7 @@
{%- if config.symbols_count_time.time %}
<span class="post-meta-item" title="{{ __('symbols_count_time.time') }}">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
<i class="far fa-clock"></i>
</span>
{%- if theme.symbols_count_time.item_text_post %}
<span class="post-meta-item-text">{{ __('symbols_count_time.time') }} &asymp;</span>
Expand Down
4 changes: 2 additions & 2 deletions layout/_partials/footer.swig
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
&copy; {% if theme.footer.since and theme.footer.since != copyright_year %}{{ theme.footer.since }} – {% endif %}
<span itemprop="copyrightYear">{{ copyright_year }}</span>
<span class="with-love">
<i class="fa fa-{{ theme.footer.icon.name }}"></i>
<i class="{{ theme.footer.icon.name }}"></i>
</span>
<span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright or author }}</span>

{%- if config.symbols_count_time.total_symbols %}
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-area-chart"></i>
<i class="fa fa-chart-area"></i>
</span>
{%- if theme.symbols_count_time.item_text_total %}
<span class="post-meta-item-text">{{ __('symbols_count_time.count_total') + __('symbol.colon') }}</span>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

{{ next_font() }}

{%- set font_awesome_uri = theme.vendors.fontawesome or next_vendors('font-awesome/css/font-awesome.min.css') %}
{%- set font_awesome_uri = theme.vendors.fontawesome or next_vendors('font-awesome/css/all.min.css') %}
<link rel="stylesheet" href="{{ font_awesome_uri }}">

{%- if theme.fancybox %}
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/header/menu-item.swig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/post/post-copyright.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set ccIcon = '<i class="fa fa-fw fa-creative-commons"></i>' %}
{%- set ccIcon = '<i class="fab fa-fw fa-creative-commons"></i>' %}
{%- set ccText = theme.creative_commons.license | upper %}

<div>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/post/post-followme.swig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="social-item">
<a target="_blank" class="social-link" href="{{ link }}">
<span class="icon">
<i class="fa fa-{{ icon }}"></i>
<i class="{{ icon }}"></i>
</span>

<span class="label">{{ name }}</span>
Expand Down
6 changes: 3 additions & 3 deletions layout/_partials/sidebar/site-overview.swig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{%- if theme.chat.service == 'tidio' and theme.tidio.enable %}
<a onclick="tidioChatApi.open();">
{%- endif %}
{%- if theme.chat.icon %}<i class="fa fa-{{ theme.chat.icon }}"></i>{%- endif %}
{%- if theme.chat.icon %}<i class="{{ theme.chat.icon }}"></i>{%- endif %}
{{ theme.chat.text }}
</a>
</div>
Expand All @@ -80,7 +80,7 @@
<span class="links-of-author-item">
{%- set sidebarURL = link.split('||')[0] | trim %}
{%- if theme.social_icons.enable %}
{%- set sidebarIcon = '<i class="fa fa-fw fa-' + link.split('||')[1] | trim + '"></i>' %}
{%- set sidebarIcon = '<i class="' + link.split('||')[1] | trim + ' fa-fw"></i>' %}
{%- else %}
{%- set sidebarIcon = '' %}
{%- endif %}
Expand All @@ -106,7 +106,7 @@
{%- if theme.links %}
<div class="links-of-blogroll motion-element">
<div class="links-of-blogroll-title">
<i class="fa fa-fw fa-{{ (theme.links_settings.icon or 'link') | lower }}"></i>
{%- if theme.links_settings.icon %}<i class="{{ theme.links_settings.icon }} fa-fw"></i>{%- endif %}
{{ theme.links_settings.title }}
</div>
<ul class="links-of-blogroll-list">
Expand Down
4 changes: 2 additions & 2 deletions layout/_third-party/statistics/busuanzi-counter.swig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- if theme.busuanzi_count.total_visitors %}
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_visitors_icon }}"></i>
<i class="{{ theme.busuanzi_count.total_visitors_icon }}"></i>
</span>
<span class="site-uv" title="{{ __('footer.total_visitors') }}">
<span id="busuanzi_value_site_uv"></span>
Expand All @@ -20,7 +20,7 @@
{%- if theme.busuanzi_count.total_views %}
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_views_icon }}"></i>
<i class="{{ theme.busuanzi_count.total_views_icon }}"></i>
</span>
<span class="site-pv" title="{{ __('footer.total_views') }}">
<span id="busuanzi_value_site_pv"></span>
Expand Down
2 changes: 1 addition & 1 deletion scripts/filters/comment/changyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('changyan', `
{% if post.comments %}
<span class="post-meta-item">
${iconText('comment-o', 'changyan')}
${iconText('far fa-comment', 'changyan')}
{% if is_post() %}
<a title="changyan" href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl">
<span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentCount"></span>
Expand Down
2 changes: 1 addition & 1 deletion scripts/filters/comment/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
}
return `
<span class="post-meta-item-icon">
<i class="fa fa-${icon}"></i>
<i class="${icon}"></i>
</span>
{%- set post_meta_comment = __('post.comments.${key}') %}
{%- if post_meta_comment == 'post.comments.${key}' %}
Expand Down
2 changes: 1 addition & 1 deletion scripts/filters/comment/disqus.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('disqus', `
{% if post.comments %}
<span class="post-meta-item">
${iconText('comment-o', 'disqus')}
${iconText('far fa-comment', 'disqus')}
<a title="disqus" href="{{ url_for(post.path) }}#disqus_thread" itemprop="discussionUrl">
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentCount"></span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion scripts/filters/comment/valine.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('valine', `
{% if post.comments and (is_post() or theme.valine.comment_count) %}
<span class="post-meta-item">
${iconText('comment-o', 'valine')}
${iconText('far fa-comment', 'valine')}
<a title="valine" href="{{ url_for(post.path) }}#valine-comments" itemprop="discussionUrl">
<span class="post-comments-count valine-comment-count" data-xid="{{ url_for(post.path) }}" itemprop="commentCount"></span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion scripts/filters/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hexo.extend.filter.register('after_post_render', data => {
if (!link.protocol || link.hostname === siteHost) return match;

// If title atribute filled, set it as title; if not, set url as title.
return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}" title="${href}">${html}<i class="fa fa-external-link"></i></span>`;
return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}" title="${href}">${html}<i class="fa fa-external-link-alt"></i></span>`;
});
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hexo.extend.helper.register('next_vendors', function(url) {
hexo.extend.helper.register('post_edit', function(src) {
const theme = hexo.theme.config;
if (!theme.post_edit.enable) return '';
return this.next_url(theme.post_edit.url + src, '<i class="fa fa-pencil"></i>', {
return this.next_url(theme.post_edit.url + src, '<i class="fa fa-pencil-alt"></i>', {
class: 'post-edit-link',
title: this.__('post.edit')
});
Expand Down
11 changes: 6 additions & 5 deletions scripts/tags/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@

function postButton(args) {
args = args.join(' ').split(',');
var url = args[0];
var text = args[1] || '';
var icon = args[2] || '';
var title = args[3] || '';
let url = args[0];
let text = args[1] || '';
let icon = args[2] || '';
let title = args[3] || '';

if (!url) {
hexo.log.warn('URL can NOT be empty.');
}

text = text.trim();
icon = icon.trim();
icon = icon.startsWith('fa') ? icon : 'fa fa-' + icon;
title = title.trim();

return `<a class="btn" href="${url}"${title.length > 0 ? ` title="${title}"` : ''}>
${icon.length > 0 ? `<i class="fa fa-${icon}"></i>` : ''}${text}
${icon.length > 0 ? `<i class="${icon}"></i>` : ''}${text}
</a>`;
}

Expand Down
Loading

0 comments on commit e61c2e0

Please sign in to comment.