Skip to content

Commit c8a460e

Browse files
committed
重命名 ExternalLink 为IconLink
1 parent 8142b35 commit c8a460e

7 files changed

Lines changed: 67 additions & 67 deletions

File tree

packages/pure/components/basic/Footer.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from 'virtual:config'
44
import { getPlatformLabel, hasIcon } from '../../libs/social'
55
import { Icon } from '../user'
66
import type { IconName } from '../../libs/icons'
7-
import ExternalLink from '@/components/ExternalLink.astro'
7+
import IconLink from '@/components/IconLink.astro'
88
99
const footerConf = config.footer
1010
const footerLink1 = footerConf.links?.filter(({ pos }) => pos === 1) || []
@@ -99,12 +99,12 @@ const socialLinks = normalizeSocialLinks(footerConf.social)
9999
{
100100
footerConf.credits && (
101101
<span class='inline-flex items-center gap-x-2'>
102-
<ExternalLink
102+
<IconLink
103103
href='https://github.com/cworld1/astro-theme-pure'
104104
class='hover:text-primary'
105105
>
106106
Astro & Pure theme
107-
</ExternalLink>
107+
</IconLink>
108108
<span class='inline-flex items-center gap-x-1'>powered</span>
109109
</span>
110110
)

packages/pure/components/user/TimelineItem.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* 使用示例:
77
* <Timeline>
88
* <TimelineItem date="2025-01-01">
9-
* 内容可以使用任意组件,如 <ExternalLink href="...">链接</ExternalLink>
9+
* 内容可以使用任意组件,如 <IconLink href="...">链接</IconLink>
1010
* </TimelineItem>
1111
* <TimelineItem date="2025-01-01" milestone>
1212
* 里程碑节点,会有特殊样式

packages/pure/plugins/rehype-external-links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function rehypeExternalLinks(options: ExternalLinkOptions = {}) {
2626
return function transformer(tree: Root): void {
2727
visit(tree, 'element', (node: Element) => {
2828
if (node.tagName === 'a' && typeof node.properties?.href === 'string') {
29-
// 跳过已经处理过的链接(由 ExternalLink 组件处理的)
29+
// 跳过已经处理过的链接(由 IconLink 组件处理的)
3030
if (node.properties['data-external-link-processed']) {
3131
return
3232
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
/**
3-
* 外部链接组件,自动添加图标和属性
3+
* 图标链接组件,自动添加图标和属性
44
*
55
* 使用示例:
6-
* <ExternalLink href="https://google.com">Google</ExternalLink>
6+
* <IconLink href="https://google.com">Google</IconLink>
77
*/
88
99
import { Icons } from 'astro-pure/libs'

src/content/blog/test/test_link-with-icon.mdx

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
---
2-
title: '建站: ExternalLink 组件'
3-
description: '展示 ExternalLink 组件的用法和效果,自动为外部链接添加图标'
2+
title: '建站: IconLink 组件'
3+
description: '展示 IconLink 组件的用法和效果,自动为外部链接添加图标'
44
publishDate: 2025-11-14 17:00:16
55
slug: 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'
1010
import { 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

Comments
 (0)