···393940404. Use `pnpm new <title>` to create new posts, or add your posts to `src/content/posts`.
41414242-5. Deploy to Netlify, Vercel, or other platforms, refer to [Astro Deployment Guides](https://docs.astro.build/en/guides/deploy/) for more details.
4242+5. You need to set adapter as follows before deploying to Netlify, Vercel, or other platforms, but you can set `linkCard` to `false` in `src/config.ts` to skip this step:
4343 - **Netlify**: `pnpm add @astrojs/netlify` and add `adapter: netlify()` in `astro.config.ts`.
4444 - **Vercel**: `pnpm add @astrojs/vercel` and add `adapter: vercel()` in `astro.config.ts`.
4545 - **Static (e.g. GitHub Pages)**: `pnpm add @astrojs/static` and add `adapter: static()` in `astro.config.ts`.
4646-4646+ - Refer to [Astro Deployment Guides](https://docs.astro.build/en/guides/deploy/) for more details.
47474848 [](https://app.netlify.com/start) [](https://vercel.com/new)
4949
···11+// toggle-proxy.ts
22+import fs from 'fs'
33+import path from 'path'
44+import { fileURLToPath } from 'url'
55+66+// Compatible with ES module __dirname
77+const __filename = fileURLToPath(import.meta.url)
88+const __dirname = path.dirname(__filename)
99+1010+const configPath = path.resolve(__dirname, '../src/config.ts')
1111+const proxyPath = path.resolve(__dirname, '../src/pages/api/proxy.ts')
1212+const backupPath = path.resolve(__dirname, '../src/pages/api/proxy.ts.bak')
1313+const astroConfigPath = path.resolve(__dirname, '../astro.config.ts')
1414+1515+// Read config.ts content
1616+const configContent = fs.readFileSync(configPath, 'utf-8')
1717+1818+// Use regex to extract linkCard config (assuming the format does not change)
1919+const match = configContent.match(/linkCard:\s*(true|false)/)
2020+if (!match) {
2121+ console.error('linkCard config not found')
2222+ process.exit(1)
2323+}
2424+const linkCardEnabled: boolean = match[1] === 'true'
2525+2626+// Helper to comment/uncomment adapter lines in astro.config.ts
2727+function toggleAstroAdapter(comment: boolean) {
2828+ const astroConfig = fs.readFileSync(astroConfigPath, 'utf-8').split('\n')
2929+ // 16: import netlify..., 19: adapter: netlify() (0-based)
3030+ const importIdx = 16
3131+ const adapterIdx = 19
3232+ if (comment) {
3333+ if (!astroConfig[importIdx].trim().startsWith('//')) {
3434+ astroConfig[importIdx] = '// ' + astroConfig[importIdx]
3535+ }
3636+ if (!astroConfig[adapterIdx].trim().startsWith('//')) {
3737+ astroConfig[adapterIdx] = '// ' + astroConfig[adapterIdx]
3838+ }
3939+ } else {
4040+ if (astroConfig[importIdx].trim().startsWith('//')) {
4141+ astroConfig[importIdx] = astroConfig[importIdx].replace(/^\/\/\s?/, '')
4242+ }
4343+ if (astroConfig[adapterIdx].trim().startsWith('//')) {
4444+ astroConfig[adapterIdx] = astroConfig[adapterIdx].replace(/^\/\/\s?/, '')
4545+ }
4646+ }
4747+ fs.writeFileSync(astroConfigPath, astroConfig.join('\n'), 'utf-8')
4848+}
4949+5050+if (!linkCardEnabled) {
5151+ // If linkCard is disabled, rename proxy.ts and comment adapter
5252+ if (fs.existsSync(proxyPath)) {
5353+ fs.renameSync(proxyPath, backupPath)
5454+ console.log('🟡 proxy.ts disabled')
5555+ }
5656+ toggleAstroAdapter(true)
5757+ console.log('🟡 adapter config commented')
5858+} else {
5959+ // If linkCard is enabled, restore proxy.ts and uncomment adapter
6060+ if (fs.existsSync(backupPath)) {
6161+ fs.renameSync(backupPath, proxyPath)
6262+ console.log('🔵 proxy.ts enabled')
6363+ }
6464+ toggleAstroAdapter(false)
6565+ console.log('🔵 adapter config uncommented')
6666+}
+3-2
src/config.ts
···3030 // POST SETTINGS ///////////////////////////////////////////////////////////////////////////////////////
3131 post: {
3232 readingTime: false, // Show reading time in posts
3333- toc: true, // Show the table of contents (when there is enough page width)
3333+ toc: true, // Show table of contents (when there is enough page width)
3434 imageViewer: true, // Enable image viewer
3535- copyCode: true // Enable copy button in code blocks
3535+ copyCode: true, // Enable copy button in code blocks
3636+ linkCard: true // Enable link card
3637 }
3738}
+3-8
src/content/posts/embedded-content.md
···3333```
3434🟡
35353636-If you don’t need Link Card, you can skip adapter setup:
3737-3838-- Run「pnpm remove @astrojs/netlify」
3939-- Delete the following content:
4040- - src/component/ui/LinkCard.astro
4141- - src/plugins/remark-embedded-media.mjs (Lines 8 - 32)
4242- - src/pages/api/proxy.ts
4343- - astro.config.ts (Lines 17 & 20)
3636+If you don’t need Link Card,
3737+you can set `linkCard` to `false` in `src/config.ts`,
3838+then you don't need to set adapter before building.
4439```
45404641## Spotify
+4-2
src/content/posts/theme-guide.md
···7373post: {
7474 // Show reading time in posts
7575 readingTime: false,
7676- // Show the table of contents (when there is enough page width)
7676+ // Show table of contents (when there is enough page width)
7777 toc: true,
7878 // Enable image viewer
7979 imageViewer: true,
8080 // Enable copy button in code blocks
8181- copyCode: true
8181+ copyCode: true,
8282+ // Enable link card
8383+ linkCard: true
8284}
8385```
8486