Skip to content

Commit cfb62cb

Browse files
committed
[ Add ] Sponsor List widget
[ Fix ] Several details
1 parent eeacc33 commit cfb62cb

File tree

13 files changed

+2052
-43
lines changed

13 files changed

+2052
-43
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ cache:
99
directories:
1010
- node_modules
1111

12+
before_install:
13+
- export TZ=${TIME_ZONE}
1214
install:
1315
- npm install
1416
- cd ${FOLDER_SOURCE}

ReadMe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ git push
8383

8484
1. [活动时空](themes/Icarus/layout/activity.ejs)
8585

86-
2. [社群伙伴](themes/Icarus/layout/volunteer.ejs)
86+
2. [社群伙伴](themes/Icarus/layout/community.ejs)
8787

8888
### 工具函数
8989

90-
1. [博文分类判断](themes/Icarus/includes/helpers/data.js#L14)
90+
1. [博文分类判断](themes/Icarus/includes/helpers/data.js#L11)
9191

92-
2. [获取文件类型](themes/Icarus/includes/helpers/data.js#L19)
92+
2. [获取文件类型](themes/Icarus/includes/helpers/data.js#L22)
9393

94-
3. [DataURI 生成](themes/Icarus/includes/helpers/data.js#L30)
94+
3. [DataURI 生成](themes/Icarus/includes/helpers/data.js#L33)
9595

96-
4. [iCalendar 事件](themes/Icarus/includes/helpers/data.js#L36)
96+
4. [iCalendar 事件](themes/Icarus/includes/helpers/data.js#L38)

package-lock.json

Lines changed: 1960 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"hexo-generator-index": "^0.2.1",
2323
"hexo-generator-slidehtml": "0.0.62",
2424
"hexo-generator-tag": "^0.2.0",
25+
"hexo-migrator-web": "^0.4.4",
2526
"hexo-permalink-pinyin": "git+https://github.com/viko16/hexo-permalink-pinyin.git",
2627
"hexo-pwa": "^0.1.3",
2728
"hexo-reference": "^1.0.4",

themes/Icarus/_config.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ navbar:
2727
相册: http://cdfcc.lofter.com/
2828
博文: /categories
2929
大会: https://web-conf.tk/
30-
社群: /volunteer
30+
社群: /community
3131
关于: /categories/Profile/
3232
# Navigation bar links to be shown on the right
3333
links:
@@ -122,20 +122,31 @@ widgets:
122122
follow_link: https://github.com/FreeCodeCamp-Chengdu
123123
# Links to be shown on the bottom of the profile widget
124124
social_links:
125-
微博:
126-
icon: fab fa-weibo
127-
url: https://weibo.com/u/6165665516
128-
GitHub:
129-
icon: fab fa-github
130-
url: https://github.com/FreeCodeCamp-Chengdu
131125
RSS:
132126
icon: fas fa-rss
133127
url: atom.xml
128+
GitHub:
129+
icon: fab fa-github
130+
url: https://github.com/FreeCodeCamp-Chengdu
131+
微博:
132+
icon: fab fa-weibo
133+
url: https://weibo.com/u/6165665516
134+
微信服务号:
135+
icon: fab fa-weixin
136+
url: contact/#微信服务号
137+
QQ 群:
138+
icon: fab fa-qq
139+
url: contact/#QQ-群
134140
-
135141
# Widget name
136142
type: recent_posts
137143
# Where should the widget be placed, left or right
138144
position: left
145+
-
146+
# Widget name
147+
type: toc
148+
# Where should the widget be placed, left or right
149+
position: right
139150
-
140151
# Widget name
141152
type: links
@@ -147,11 +158,6 @@ widgets:
147158
技术周刊: https://github.com/FreeCodeCamp-Chengdu/IT-Technology-weekly
148159
国际总部: https://www.freecodecamp.org/
149160
中文论坛: https://chinese.freecodecamp.org/forum/
150-
-
151-
# Widget name
152-
type: toc
153-
# Where should the widget be placed, left or right
154-
position: right
155161
-
156162
type: archive
157163
position: right
@@ -170,7 +176,7 @@ plugins:
170176
outdated-browser: true
171177
# Enable the MathJax plugin
172178
# http://ppoffice.github.io/hexo-theme-icarus/Plugins/General/mathjax-plugin/
173-
mathjax: true
179+
mathjax: false
174180
# Show the back to top button on mobile devices
175181
back-to-top: true
176182
# Google Analytics plugin settings

themes/Icarus/includes/helpers/data.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ const { VEvent } = require('icalendar'),
88
pptx: 'powerpoint'
99
};
1010

11+
function has_category(post, name) {
1112

12-
module.exports = function (hexo) {
13+
return Array.from(
14+
(post.categories || '').data, ({ name }) => name
15+
).includes( name )
16+
}
1317

14-
hexo.extend.helper.register('has_category', (post, name) =>
18+
module.exports = function (hexo) {
1519

16-
Array.from((post.categories || '').data, ({ name }) => name).includes( name )
17-
);
20+
hexo.extend.helper.register('has_category', has_category);
1821

1922
hexo.extend.helper.register('file_type', path => {
2023

@@ -48,4 +51,19 @@ module.exports = function (hexo) {
4851
return event;
4952
}
5053
);
54+
55+
const url_for = hexo.extend.helper.get('url_for');
56+
57+
hexo.extend.helper.register('sponsor_list', function (posts) {
58+
59+
return posts.map(({categories, source, title, path, thumbnail, website}) =>
60+
61+
has_category({ categories }, 'Sponsor') && {
62+
name: source.match( /([^/\\]+)\.\w+$/i )[1],
63+
title,
64+
logo: url_for.call(this, path + thumbnail),
65+
URL: website
66+
}
67+
).filter(Boolean)
68+
});
5169
};

themes/Icarus/includes/helpers/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module.exports = function (hexo) {
9696

9797
return this.url_for(
9898
hasThumbnail ?
99-
(post.thumbnail || (post.path + post.photos[0])) :
99+
post.path + (post.thumbnail || post.photos[0]) :
100100
'images/thumbnail.svg'
101101
);
102102
});

themes/Icarus/layout/activity.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<hr>
2222

23-
<h3>FCC 成都社区的足迹</h3>
23+
<h3>社区足迹</h3>
2424
<%-
2525
partial('widget/marker_map', {
2626
markers: site.posts.map(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@
1313
posts: site.posts
1414
})
1515
%>
16+
<%-
17+
partial('widget/team', {
18+
keyMap: {
19+
sponsors: '赞助'
20+
},
21+
data: sponsor_list(site.posts),
22+
count: true,
23+
posts: site.posts
24+
})
25+
%>
1626
</div>
1727
</main>

0 commit comments

Comments
 (0)