Skip to content

Commit ebc9606

Browse files
committed
修改 MoeICP 的插入方式
1 parent 378da62 commit ebc9606

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
rm -rf source/favicon
4747
curl https://cdn.jsdelivr.net/gh/PrismJS/prism-themes@master/themes/prism-material-light.min.css --create-dirs -o node_modules/prismjs/themes/prism-materiallight.css
4848
curl https://cdn.jsdelivr.net/gh/PrismJS/prism-themes@master/themes/prism-material-oceanic.min.css --create-dirs -o node_modules/prismjs/themes/prism-materialoceanic.css
49-
sed -i 's,http://,https://,g' node_modules/hexo-theme-fluid/layout/_partials/footer/beian.ejs
49+
mv source/beian.ejs node_modules/hexo-theme-fluid/layout/_partials/footer/beian.ejs
5050
- name: Patch for CN-Domain website
5151
if: ${{ matrix.platform == 'cn' }}
5252
run: |
@@ -59,11 +59,11 @@ jobs:
5959
sed -i 's/icp_text: 浙ICP备2021017952号-1/icp_text: 浙ICP备2021017952号-2/g' _config.fluid.yml
6060
sed -i 's/police_text: 浙公网安备33010602011812号/police_text:/g' _config.fluid.yml
6161
sed -i 's/police_code: 33010602011812/police_code:/g' _config.fluid.yml
62+
sed -i 's/moeicp_code: 20221816/moeicp_code: 20241816/g' _config.fluid.yml
6263
- name: Build
6364
run: |
6465
hexo g
6566
sed -i 's,IEJUMPIEJUMPIEJUMP,if(/*@cc_on!@*/false||(!!window.MSInputMethodContext\&\&!!document.documentMode))window.location.href="https://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href);,g' $(grep IEJUMPIEJUMPIEJUMP -rl ./public)
66-
sed -i "s,<div class=\"beian\"><span>,<div class=\"beian\"><span><a href=\"https://icp.gov.moe/?keyword=$MOEICP\"target=\"_blank\"rel=\"nofollow\">萌ICP备$MOEICP号</a></span><span style=\"margin-bottom:.25rem\">,g" $(grep '<div class=\"beian\">' -rl ./public)
6767
- name: Clean up
6868
run: |
6969
cd public

_config.fluid.yml

+2
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ footer:
456456
police_code: 33010602011812
457457
# 公安备案的图片. 为空时不显示备案图片
458458
police_icon: /img/police_beian.png
459+
# 萌 ICP 备案号
460+
moeicp_code: 20221816
459461

460462
#---------------------------
461463
# 首页

scripts/head_injector.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/beian.ejs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<div class="beian" style="flex-direction: column; align-items: center">
2+
<% if(theme.footer.beian.moeicp_code) { %>
3+
<span>
4+
<a href="https://icp.gov.moe/?keyword=<%= theme.footer.beian.moeicp_code %>" target="_blank" rel="nofollow noopener">
5+
ICP<%- theme.footer.beian.moeicp_code %>
6+
</a>
7+
</span>
8+
<% } %>
9+
<% if(theme.footer.beian.icp_text) { %>
10+
<span>
11+
<a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow noopener">
12+
<%- theme.footer.beian.icp_text %>
13+
</a>
14+
</span>
15+
<% } %>
16+
<% if(theme.footer.beian.police_text) { %>
17+
<% if(theme.footer.beian.police_code) { %>
18+
<span>
19+
<a href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=<%= theme.footer.beian.police_code %>"
20+
target="_blank" rel="nofollow noopener" class="beian-police">
21+
<% if(theme.footer.beian.police_icon) { %>
22+
<img src="<%= url_for(theme.footer.beian.police_icon) %>" alt="police-icon" />
23+
<% } %>
24+
<span><%- theme.footer.beian.police_text %></span>
25+
</a>
26+
</span>
27+
<% } else { %>
28+
<span class="beian-police">
29+
<% if(theme.footer.beian.police_icon) { %>
30+
<img src="<%= url_for(theme.footer.beian.police_icon) %>" alt="police-icon" />
31+
<% } %>
32+
<span class="beian-police"><%- theme.footer.beian.police_text %></span>
33+
</span>
34+
<% } %>
35+
<% } %>
36+
</div>
37+
<style>
38+
footer .beian > span:last-child {
39+
margin: 0
40+
}
41+
footer .beian > span:not(:last-child) {
42+
margin: 0 0 .25rem 0
43+
}
44+
</style>

0 commit comments

Comments
 (0)