11---
2- title : ' 建站: ExternalLink 组件'
3- description : ' 展示 ExternalLink 组件的用法和效果,自动为外部链接添加图标'
2+ title : ' 建站: IconLink 组件'
3+ description : ' 展示 IconLink 组件的用法和效果,自动为外部链接添加图标'
44publishDate : 2025-11-14 17:00:16
55slug : 7f83
6- tags : ['建站', 'external -link', 'icon']
6+ tags : ['建站', 'icon -link', 'icon']
77---
88
9- import ExternalLink from ' @/components/ExternalLink .astro'
9+ import IconLink from ' @/components/IconLink .astro'
1010import { MdxRepl } from ' astro-pure/user'
1111
12- 本页面展示了 ` <ExternalLink > ` 组件的各种用法和效果。
12+ 本页面展示了 ` <IconLink > ` 组件的各种用法和效果。
1313
1414## 1. 基础用法 (Basic Usage)
1515
1616### 1.1. 外部链接(自动添加图标)
1717
1818<MdxRepl >
1919 <p >
20- 访问 <ExternalLink href = " https://www.google.com" >Google</ExternalLink > 搜索信息。
20+ 访问 <IconLink href = " https://www.google.com" >Google</IconLink > 搜索信息。
2121 </p >
2222
2323 <Fragment slot = ' desc' >
2424 ```` mdx
25- import ExternalLink from '@/components/ExternalLink .astro'
25+ import IconLink from '@/components/IconLink .astro'
2626
27- <ExternalLink href = " https://www.google.com" >Google</ExternalLink >
27+ <IconLink href = " https://www.google.com" >Google</IconLink >
2828 ````
2929 </Fragment >
3030</MdxRepl >
@@ -33,12 +33,12 @@ import { MdxRepl } from 'astro-pure/user'
3333
3434<MdxRepl >
3535 <p >
36- 这是一个 <ExternalLink href = " /about" >内部链接</ExternalLink >,不会添加图标。
36+ 这是一个 <IconLink href = " /about" >内部链接</IconLink >,不会添加图标。
3737 </p >
3838
3939 <Fragment slot = ' desc' >
4040 ```` mdx
41- <ExternalLink href = " /about" >内部链接</ExternalLink >
41+ <IconLink href = " /about" >内部链接</IconLink >
4242 ````
4343 </Fragment >
4444</MdxRepl >
@@ -49,12 +49,12 @@ import { MdxRepl } from 'astro-pure/user'
4949
5050<MdxRepl >
5151 <p >
52- <ExternalLink href = " https://github.com" target = " _self" rel = " nofollow" >在当前窗口打开</ExternalLink >
52+ <IconLink href = " https://github.com" target = " _self" rel = " nofollow" >在当前窗口打开</IconLink >
5353 </p >
5454
5555 <Fragment slot = ' desc' >
5656 ```` mdx
57- <ExternalLink href = " https://github.com" target = " _self" rel = " nofollow" >在当前窗口打开</ExternalLink >
57+ <IconLink href = " https://github.com" target = " _self" rel = " nofollow" >在当前窗口打开</IconLink >
5858 ````
5959 </Fragment >
6060</MdxRepl >
@@ -63,12 +63,12 @@ import { MdxRepl } from 'astro-pure/user'
6363
6464<MdxRepl >
6565 <p >
66- <ExternalLink href = " https://www.google.com" class = " text-primary font-bold" >带自定义样式的链接</ExternalLink >
66+ <IconLink href = " https://www.google.com" class = " text-primary font-bold" >带自定义样式的链接</IconLink >
6767 </p >
6868
6969 <Fragment slot = ' desc' >
7070 ```` mdx
71- <ExternalLink href = " https://www.google.com" class = " text-primary font-bold" >带自定义样式的链接</ExternalLink >
71+ <IconLink href = " https://www.google.com" class = " text-primary font-bold" >带自定义样式的链接</IconLink >
7272 ````
7373 </Fragment >
7474</MdxRepl >
@@ -77,7 +77,7 @@ import { MdxRepl } from 'astro-pure/user'
7777
7878### 3.1. 全局配置
7979
80- 你可以在 ` src/site.config.ts ` 中配置全局的自定义图标映射,这样所有使用 ` <ExternalLink > ` 组件的地方都会自动应用这些配置。
80+ 你可以在 ` src/site.config.ts ` 中配置全局的自定义图标映射,这样所有使用 ` <IconLink > ` 组件的地方都会自动应用这些配置。
8181
8282** 配置示例:**
8383
@@ -115,12 +115,12 @@ export const theme: ThemeUserConfig = {
115115
116116<MdxRepl >
117117 <p >
118- 访问 <ExternalLink href = " https://github.com" >GitHub</ExternalLink >(使用全局配置的自定义图标)。
118+ 访问 <IconLink href = " https://github.com" >GitHub</IconLink >(使用全局配置的自定义图标)。
119119 </p >
120120
121121 <Fragment slot = ' desc' >
122122 ```` mdx
123- <ExternalLink href = " https://github.com" >GitHub</ExternalLink >
123+ <IconLink href = " https://github.com" >GitHub</IconLink >
124124 ````
125125 </Fragment >
126126</MdxRepl >
@@ -131,12 +131,12 @@ export const theme: ThemeUserConfig = {
131131
132132<MdxRepl >
133133 <p >
134- <ExternalLink href = " https://www.google.com" customIcons = { { ' www.google.com' : ' github' }} >Google(使用 GitHub 图标)</ExternalLink >
134+ <IconLink href = " https://www.google.com" customIcons = { { ' www.google.com' : ' github' }} >Google(使用 GitHub 图标)</IconLink >
135135 </p >
136136
137137 <Fragment slot = ' desc' >
138138 ```` mdx
139- <ExternalLink href = " https://www.google.com" customIcons = { { ' www.google.com' : ' github' }} >Google(使用 GitHub 图标)</ExternalLink >
139+ <IconLink href = " https://www.google.com" customIcons = { { ' www.google.com' : ' github' }} >Google(使用 GitHub 图标)</IconLink >
140140 ````
141141 </Fragment >
142142</MdxRepl >
@@ -147,12 +147,12 @@ export const theme: ThemeUserConfig = {
147147
148148<MdxRepl >
149149 <p >
150- <ExternalLink href = " https://www.google.com" >默认图标大小</ExternalLink >
150+ <IconLink href = " https://www.google.com" >默认图标大小</IconLink >
151151 </p >
152152
153153 <Fragment slot = ' desc' >
154154 ```` mdx
155- <ExternalLink href = " https://www.google.com" >默认图标大小</ExternalLink >
155+ <IconLink href = " https://www.google.com" >默认图标大小</IconLink >
156156 ````
157157 </Fragment >
158158</MdxRepl >
@@ -161,12 +161,12 @@ export const theme: ThemeUserConfig = {
161161
162162<MdxRepl >
163163 <p >
164- <ExternalLink href = " https://www.google.com" iconSize = { 24 } >更大的图标(24px)</ExternalLink >
164+ <IconLink href = " https://www.google.com" iconSize = { 24 } >更大的图标(24px)</IconLink >
165165 </p >
166166
167167 <Fragment slot = ' desc' >
168168 ```` mdx
169- <ExternalLink href = " https://www.google.com" iconSize = { 24 } >更大的图标(24px)</ExternalLink >
169+ <IconLink href = " https://www.google.com" iconSize = { 24 } >更大的图标(24px)</IconLink >
170170 ````
171171 </Fragment >
172172</MdxRepl >
@@ -177,17 +177,17 @@ export const theme: ThemeUserConfig = {
177177
178178<MdxRepl >
179179 <p >
180- 本网站使用 <ExternalLink href = " https://astro.build" >Astro</ExternalLink > 框架构建,
181- 主题基于 <ExternalLink href = " https://github.com/cworld1/astro-theme-pure" >Astro Theme Pure</ExternalLink >。
182- 评论系统使用 <ExternalLink href = " https://waline.js.org" >Waline</ExternalLink >。
180+ 本网站使用 <IconLink href = " https://astro.build" >Astro</IconLink > 框架构建,
181+ 主题基于 <IconLink href = " https://github.com/cworld1/astro-theme-pure" >Astro Theme Pure</IconLink >。
182+ 评论系统使用 <IconLink href = " https://waline.js.org" >Waline</IconLink >。
183183 </p >
184184
185185 <Fragment slot = ' desc' >
186186 ```` mdx
187187 <p >
188- 本网站使用 <ExternalLink href = " https://astro.build" >Astro</ExternalLink > 框架构建,
189- 主题基于 <ExternalLink href = " https://github.com/cworld1/astro-theme-pure" >Astro Theme Pure</ExternalLink >。
190- 评论系统使用 <ExternalLink href = " https://waline.js.org" >Waline</ExternalLink >。
188+ 本网站使用 <IconLink href = " https://astro.build" >Astro</IconLink > 框架构建,
189+ 主题基于 <IconLink href = " https://github.com/cworld1/astro-theme-pure" >Astro Theme Pure</IconLink >。
190+ 评论系统使用 <IconLink href = " https://waline.js.org" >Waline</IconLink >。
191191 </p >
192192 ````
193193 </Fragment >
@@ -197,17 +197,17 @@ export const theme: ThemeUserConfig = {
197197
198198<MdxRepl >
199199 <ul >
200- <li ><ExternalLink href = " https://www.google.com" >Google</ExternalLink ></li >
201- <li ><ExternalLink href = " https://github.com" >GitHub</ExternalLink ></li >
202- <li ><ExternalLink href = " https://stackoverflow.com" >Stack Overflow</ExternalLink ></li >
200+ <li ><IconLink href = " https://www.google.com" >Google</IconLink ></li >
201+ <li ><IconLink href = " https://github.com" >GitHub</IconLink ></li >
202+ <li ><IconLink href = " https://stackoverflow.com" >Stack Overflow</IconLink ></li >
203203 </ul >
204204
205205 <Fragment slot = ' desc' >
206206 ```` mdx
207207 <ul >
208- <li ><ExternalLink href = " https://www.google.com" >Google</ExternalLink ></li >
209- <li ><ExternalLink href = " https://github.com" >GitHub</ExternalLink ></li >
210- <li ><ExternalLink href = " https://stackoverflow.com" >Stack Overflow</ExternalLink ></li >
208+ <li ><IconLink href = " https://www.google.com" >Google</IconLink ></li >
209+ <li ><IconLink href = " https://github.com" >GitHub</IconLink ></li >
210+ <li ><IconLink href = " https://stackoverflow.com" >Stack Overflow</IconLink ></li >
211211 </ul >
212212 ````
213213 </Fragment >
@@ -217,12 +217,12 @@ export const theme: ThemeUserConfig = {
217217
218218<MdxRepl >
219219 <p >
220- <ExternalLink href = " //www.google.com" >协议相对链接</ExternalLink >
220+ <IconLink href = " //www.google.com" >协议相对链接</IconLink >
221221 </p >
222222
223223 <Fragment slot = ' desc' >
224224 ```` mdx
225- <ExternalLink href = " //www.google.com" >协议相对链接</ExternalLink >
225+ <IconLink href = " //www.google.com" >协议相对链接</IconLink >
226226 ````
227227 </Fragment >
228228</MdxRepl >
0 commit comments