Skip to content

Commit ca675d2

Browse files
authored
fix: blog page display enhancements (#29)
- Add blog meta info rendering (title/date/author/description) - Fix video/iframe overflow with max-width constraint - Add copy button for code blocks - Style description as accent-bordered card - Add .gitignore for Jekyll build artifacts Co-authored-by: joeytoday <joeytoday632@outlook.com>
1 parent ecee7c4 commit ca675d2

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_site/
2+
.sass-cache/
3+
.jekyll-cache/
4+
.jekyll-metadata
5+
Gemfile.lock

_layouts/doc.html

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,25 @@
9494
.doc-content td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); color: var(--body); }
9595
.doc-content tr:hover td { background: var(--canvas-soft); }
9696
.doc-content img { max-width: 100%; border-radius: var(--rounded-md); margin: 16px 0; }
97+
.doc-content video, .doc-content iframe { max-width: 100%; height: auto; border-radius: var(--rounded-md); margin: 16px 0; display: block; }
9798
.doc-content hr { border: none; border-top: 1px solid var(--hairline); margin: 32px 0; }
9899

100+
/* Blog meta */
101+
.blog-meta { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--hairline); }
102+
.blog-meta-title { font-size: 32px; font-weight: 700; letter-spacing: -1.2px; line-height: 1.2; margin-bottom: 16px; color: var(--ink); }
103+
.blog-meta-info { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-size: 14px; color: var(--mute); margin-bottom: 16px; }
104+
.blog-meta-info span { display: inline-flex; align-items: center; gap: 6px; }
105+
.blog-meta-info svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }
106+
.blog-meta-desc { background: var(--canvas-soft); border-left: 3px solid var(--link); padding: 14px 18px; border-radius: 0 var(--rounded-sm) var(--rounded-sm) 0; font-size: 15px; color: var(--body); line-height: 1.65; margin-top: 4px; }
107+
108+
/* Code copy button */
109+
.code-block-wrapper { position: relative; margin-bottom: 20px; }
110+
.code-block-wrapper pre { margin-bottom: 0; padding-right: 48px; }
111+
.copy-btn { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.7); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; }
112+
.copy-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }
113+
.copy-btn.copied { background: rgba(34,197,94,0.3); border-color: rgba(34,197,94,0.4); color: #4ade80; }
114+
.copy-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
115+
99116
/* Page footer */
100117
.doc-footer { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--hairline); font-size: 13px; color: var(--mute); }
101118
.doc-footer a { color: var(--link); text-decoration: none; }
@@ -160,6 +177,19 @@
160177
</aside>
161178

162179
<main class="doc-content">
180+
{%- if page.layout == 'doc' and page.date and page.author -%}
181+
<div class="blog-meta">
182+
<h1 class="blog-meta-title">{{ page.title }}</h1>
183+
<div class="blog-meta-info">
184+
<span><svg viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>{{ page.date | date: "%Y-%m-%d" }}</span>
185+
<span><svg viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>{{ page.author }}</span>
186+
</div>
187+
{%- if page.description -%}
188+
<p class="blog-meta-desc">{{ page.description }}</p>
189+
{%- endif -%}
190+
</div>
191+
{%- endif -%}
192+
163193
{{ content }}
164194

165195
<div class="doc-footer">
@@ -168,5 +198,35 @@
168198
</main>
169199
</div>
170200

201+
<script>
202+
document.addEventListener('DOMContentLoaded', function() {
203+
var pres = document.querySelectorAll('.doc-content pre');
204+
pres.forEach(function(pre) {
205+
var wrapper = document.createElement('div');
206+
wrapper.className = 'code-block-wrapper';
207+
pre.parentNode.insertBefore(wrapper, pre);
208+
wrapper.appendChild(pre);
209+
210+
var btn = document.createElement('button');
211+
btn.className = 'copy-btn';
212+
btn.innerHTML = '<svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
213+
var checkSvg = '<svg viewBox="0 0 24 24"><polyline points="20 6 9 17 4 12"/></svg>';
214+
btn.addEventListener('click', function() {
215+
var code = pre.querySelector('code');
216+
var text = code ? code.textContent : pre.textContent;
217+
navigator.clipboard.writeText(text).then(function() {
218+
btn.innerHTML = checkSvg;
219+
btn.classList.add('copied');
220+
setTimeout(function() {
221+
btn.innerHTML = '<svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
222+
btn.classList.remove('copied');
223+
}, 2000);
224+
});
225+
});
226+
wrapper.appendChild(btn);
227+
});
228+
});
229+
</script>
230+
171231
</body>
172232
</html>

blog/qwencode-bailian-ai-marketing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ AI 会分别输出三个版本,可直接参考演示视频:
191191

192192
直接告诉 Qwen Code 你的公众号:AppID 和 AppSecret,在微信开发者平台把你的 ip 加入白名单,一次设置后,就能直接发布到草稿箱,完全免除排版困扰:
193193

194-
<video class="mt-5" poster="https://gw.alicdn.com/imgextra/i2/O1CN01m97GNY1VfUbVcMvst_!!6000000002680-2-tps-1582-882.png"src="https://cloud.video.taobao.com/vod/FMxYmHLotZoojvNZNojwpMFPg6vJgg7bWpJw09w1MvY.mp4" controls></video>
194+
<video class="mt-5" poster="https://gw.alicdn.com/imgextra/i2/O1CN01m97GNY1VfUbVcMvst_!!6000000002680-2-tps-1582-882.png" src="https://cloud.video.taobao.com/vod/FMxYmHLotZoojvNZNojwpMFPg6vJgg7bWpJw09w1MvY.mp4" controls></video>
195195

196196
> ps:你还可以结合我之前做的封面技能,直接解决公众号封面的问题。
197197

0 commit comments

Comments
 (0)