Skip to content

Commit b293eca

Browse files
ppippi-devclaude
andcommitted
perf(blog): comprehensive performance optimization
- Remove KaTeX (unused math rendering) - saves ~23KB CSS - Remove Giscus comments system - Convert favicon.png to SVG - saves 928KB - Remove unused Atkinson fonts - saves 45KB - Optimize Pretendard font loading (non-blocking) - Resize large WebP images (oop, main, nlp) - saves 9.3MB - Convert 78 PNG files to WebP - saves 3.7MB - Add scroll event throttling with requestAnimationFrame - Add native image lazy loading - Add HTTP caching headers (_headers) - Enable Astro prefetch for faster navigation - Update translate workflow trigger to main push Total savings: ~14MB+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1844615 commit b293eca

File tree

188 files changed

+1043
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+1043
-864
lines changed

.github/workflows/translate-to-english.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Translate new posts to English
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, reopened]
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/content/blog/**/*.md'
69

710
permissions:
811
contents: write
@@ -11,31 +14,17 @@ jobs:
1114
translate:
1215
runs-on: ubuntu-latest
1316
steps:
14-
- name: Checkout PR branch
17+
- name: Checkout main branch
1518
uses: actions/checkout@v4
1619
with:
17-
ref: ${{ github.head_ref }}
20+
fetch-depth: 2
1821

19-
- name: Get changed files from PR
22+
- name: Get changed blog posts
2023
id: changes
21-
uses: actions/github-script@v7
22-
with:
23-
script: |
24-
const pr = context.payload.pull_request;
25-
const { owner, repo } = context.repo;
26-
const pull_number = pr.number;
27-
const per_page = 100;
28-
let page = 1;
29-
const files = [];
30-
while (true) {
31-
const res = await github.rest.pulls.listFiles({ owner, repo, pull_number, per_page, page });
32-
if (res.data.length === 0) break;
33-
for (const f of res.data) files.push(f.filename);
34-
if (res.data.length < per_page) break;
35-
page += 1;
36-
}
37-
const posts = files.filter(f => f.startsWith('src/content/blog/') && f.endsWith('.md'));
38-
core.setOutput('posts', posts.join('\n'));
24+
run: |
25+
POSTS=$(git diff --name-only HEAD~1 HEAD -- 'src/content/blog/*.md' | tr '\n' ' ')
26+
echo "posts=$POSTS" >> $GITHUB_OUTPUT
27+
echo "Changed posts: $POSTS"
3928
4029
- name: Set ONLY_FILES env
4130
if: steps.changes.outputs.posts != ''
@@ -68,6 +57,6 @@ jobs:
6857
if: steps.changes.outputs.posts != ''
6958
uses: stefanzweifel/git-auto-commit-action@v5
7059
with:
71-
commit_message: "chore: add English translations for PR #${{ github.event.pull_request.number }}"
60+
commit_message: "chore: add English translations"
7261
file_pattern: 'src/content/blog-en/*.md'
7362
add_options: '-A'

astro.config.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import mdx from '@astrojs/mdx';
44
import sitemap from '@astrojs/sitemap';
55
import { defineConfig } from 'astro/config';
6-
import remarkMath from 'remark-math';
7-
import rehypeKatex from 'rehype-katex';
86
import { redirects } from './src/redirects';
97

108
// https://astro.build/config
@@ -18,9 +16,9 @@ export default defineConfig({
1816
!Object.keys(redirects).some((oldPath) => page.endsWith(oldPath)),
1917
}),
2018
],
21-
markdown: {
22-
remarkPlugins: [remarkMath],
23-
rehypePlugins: [rehypeKatex],
24-
},
2519
redirects,
20+
prefetch: {
21+
prefetchAll: true,
22+
defaultStrategy: 'viewport',
23+
},
2624
});

package-lock.json

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

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
"@astrojs/sitemap": "^3.6.0",
1616
"@pagefind/default-ui": "^1.4.0",
1717
"astro": "^5.16.5",
18-
"rehype-katex": "^7.0.1",
19-
"remark-math": "^6.0.0",
2018
"sharp": "^0.34.3"
2119
}
2220
}

public/_headers

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Static assets - long cache (1 year)
2+
/_astro/*
3+
Cache-Control: public, max-age=31536000, immutable
4+
5+
/fonts/*
6+
Cache-Control: public, max-age=31536000, immutable
7+
8+
# Images - medium cache (30 days)
9+
/img/*
10+
Cache-Control: public, max-age=2592000
11+
12+
/favicon*
13+
Cache-Control: public, max-age=2592000
14+
15+
# Pagefind search index
16+
/pagefind/*
17+
Cache-Control: public, max-age=86400
18+
19+
# HTML pages - no cache (always fresh)
20+
/*
21+
Cache-Control: public, max-age=0, must-revalidate

public/favicon.png

-932 KB
Binary file not shown.

public/fonts/atkinson-bold.woff

-23.2 KB
Binary file not shown.

public/fonts/atkinson-regular.woff

-22.3 KB
Binary file not shown.

public/img/post_img/airflow1.PNG

-19 KB
Binary file not shown.

public/img/post_img/airflow1.webp

5.23 KB

0 commit comments

Comments
 (0)