Skip to content

Commit 1c85232

Browse files
committed
rectangle fix
1 parent 7ad527e commit 1c85232

5 files changed

Lines changed: 59 additions & 6 deletions

File tree

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ if emacs --batch \
177177
entry
178178
(org-publish-find-title entry project)))
179179
:sitemap-function blog/sitemap-function
180-
:exclude \"404\\\\.org\\\\|about\\\\.org\\\\|-cn\\\\.org\")
180+
:exclude \"404\\\\.org\\\\|about\\\\.org\\\\|-cn\\\\.org\\\\|index-cn\\\\.org\")
181181
182182
(\"blog-pages\"
183183
:base-directory ,blog-posts-directory
@@ -200,7 +200,7 @@ if emacs --batch \
200200
:html-postamble blog/postamble
201201
:html-head-include-default-style nil
202202
:html-head-include-scripts nil
203-
:include (\"about.org\"))
203+
:include (\"about.org\" \"index-cn.org\"))
204204
205205
(\"blog-static\"
206206
:base-directory ,blog-static-directory

generate-sitemap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ EOF
2929

3030
# Add all HTML files (excluding drafts)
3131
for file in public/*.html; do
32-
if [ -f "$file" ] && [ "$(basename "$file")" != "404.html" ]; then
32+
if [ -f "$file" ] && [ "$(basename "$file")" != "404.html" ] && [ "$(basename "$file")" != "index-cn.html" ]; then
3333
# Get last modified date
3434
LASTMOD=$(date -r "$file" -u +%Y-%m-%d 2> /dev/null || date -u +%Y-%m-%d)
3535
FILENAME=$(basename "$file")

posts/index-cn.org

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#+TITLE: Noob Notes
2+
#+AUTHOR:
3+
#+OPTIONS: author:nil toc:nil num:nil h:0
4+
5+
- [[file:2024-10-02-babylon-cn.org][什么是 Babylon?]]
6+
- [[file:2024-06-30-syntax-highlighting-test-cn.org][语法高亮测试]]
7+
- [[file:2024-06-16-waku-cn.org][Waku 网络]]
8+
- [[file:2024-01-29-getting-started-with-emacs-cn.org][Emacs 入门:现代化方法]]

static/css/blog.css

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ body {
108108
outline-offset: 2px;
109109
}
110110

111+
/* Remove focus outline for mouse clicks, keep for keyboard */
112+
:focus:not(:focus-visible) {
113+
outline: none;
114+
}
115+
116+
/* Modern browsers - only show focus for keyboard navigation */
117+
:focus-visible {
118+
outline: 2px solid var(--accent-primary);
119+
outline-offset: 2px;
120+
}
121+
111122
/* Animations */
112123
@keyframes fadeIn {
113124
from {
@@ -359,8 +370,19 @@ a {
359370
transition: border-color 0.2s ease;
360371
}
361372

362-
a:hover,
373+
a:hover {
374+
border-bottom-color: var(--link-color);
375+
}
376+
377+
/* Remove outline on all links when clicked */
363378
a:focus {
379+
outline: none;
380+
}
381+
382+
/* Only show outline for keyboard navigation */
383+
a:focus-visible {
384+
outline: 2px solid var(--accent-primary);
385+
outline-offset: 2px;
364386
border-bottom-color: var(--link-color);
365387
}
366388

static/js/blog.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,25 @@
945945

946946
checkAndRedirect(preferredLang) {
947947
const currentPath = window.location.pathname;
948-
const currentFile = currentPath.split('/').pop();
948+
const currentFile = currentPath.split('/').pop() || 'index.html';
949+
950+
// Special handling for index pages
951+
if (currentFile === 'index.html' || currentFile === 'index-cn.html' || currentPath === '/') {
952+
if (preferredLang === 'cn' && currentFile !== 'index-cn.html') {
953+
window.location.pathname = '/index-cn.html';
954+
return;
955+
} else if (preferredLang === 'en' && currentFile === 'index-cn.html') {
956+
window.location.pathname = '/index.html';
957+
return;
958+
}
959+
}
949960

950961
// Check if we're on a post page
951962
if (
952963
currentFile &&
953964
currentFile.endsWith('.html') &&
954965
currentFile !== 'index.html' &&
966+
currentFile !== 'index-cn.html' &&
955967
currentFile !== 'about.html' &&
956968
currentFile !== '404.html'
957969
) {
@@ -1003,13 +1015,24 @@
10031015

10041016
// Handle page redirects for language switching
10051017
const currentPath = window.location.pathname;
1006-
const currentFile = currentPath.split('/').pop();
1018+
const currentFile = currentPath.split('/').pop() || 'index.html';
1019+
1020+
// Special handling for index pages
1021+
if (currentFile === 'index.html' || currentFile === 'index-cn.html' || currentPath === '/') {
1022+
if (lang === 'cn') {
1023+
window.location.pathname = '/index-cn.html';
1024+
} else {
1025+
window.location.pathname = '/index.html';
1026+
}
1027+
return;
1028+
}
10071029

10081030
// Check if we're on a post page
10091031
if (
10101032
currentFile &&
10111033
currentFile.endsWith('.html') &&
10121034
currentFile !== 'index.html' &&
1035+
currentFile !== 'index-cn.html' &&
10131036
currentFile !== 'about.html' &&
10141037
currentFile !== '404.html'
10151038
) {

0 commit comments

Comments
 (0)