Skip to content

Commit 3abe246

Browse files
Bluemangoozkqiang
authored andcommitted
✨ 增加打印样式
1 parent b67a247 commit 3abe246

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

layout/_partials/header.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
33
%>
44

5-
<div class="header-inner" style="height: <%= banner_img_height %>vh;">
5+
<div class="header-inner print-hide" style="height: <%= banner_img_height %>vh;">
66
<%- partial('_partials/header/navigation') %>
77
<%- partial('_partials/header/banner') %>
88
</div>

layout/_partials/post/copyright.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
4141
<% var items = license.split('-') %>
4242
<% for (var idx = 0; idx < items.length; idx++) { %>
43-
<a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
43+
<a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
4444
<span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
4545
<i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
4646
</span>

layout/_partials/post/meta-bottom.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="post-meta">
1010
<i class="iconfont icon-tags"></i>
1111
<% page.tags.each(function(tag) { %>
12-
<a href="<%= url_for(tag.path) %>">#<%- tag.name %></a>
12+
<a href="<%= url_for(tag.path) %>" class="print-no-link">#<%- tag.name %></a>
1313
<% }) %>
1414
</div>
1515
<% } %>

layout/layout.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.d
4040

4141
<% if (theme.scroll_top_arrow.enable) { %>
4242
<a id="scroll-top-button" aria-label="TOP" href="#" role="button">
43-
<i class="iconfont icon-arrowup" aria-hidden="true"></i>
43+
<i class="iconfont icon-arrowup print-hide" aria-hidden="true"></i>
4444
</a>
4545
<% } %>
4646

layout/post.ejs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
1515
<div id="board">
1616
<article class="post-content mx-auto">
1717
<!-- SEO header -->
18-
<h1 style="display: none"><%= page.subtitle || page.title %></h1>
18+
<h1 class="print-show" id="seo-header"><%= page.subtitle || page.title %></h1>
19+
<hr class="print-show">
1920
<% if (theme.post.updated.enable && theme.post.updated && compare_date(page.date, page.updated)) { %>
2021
<p class="note note-<%= theme.post.updated.note_class || 'info' %>">
2122
<% if (theme.post.updated.relative) { %>

source/css/_pages/_base/print.styl

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@media print
2+
a:not([href^='#']):not([href^='javascript:']):not(.print-no-link)::after
3+
content ' (' attr(href) ')'
4+
font-size 80%
5+
color #57606a
6+
7+
.print-hide
8+
display: none !important
9+
10+
@media not print
11+
.print-show
12+
display none
13+
14+
#seo-header
15+
display none

source/css/_pages/_post/post-page.styl

+7
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@
125125
-webkit-transform translateX(0)
126126
transform translateX(0)
127127

128+
#seo-header
129+
height auto;
130+
color: var(--post-heading-color);
131+
font-weight: bold;
132+
margin-bottom: 0.75em;
133+
margin-top: 2em;
134+
128135
.custom, #comments
129136
margin-top 2rem
130137

0 commit comments

Comments
 (0)