Skip to content

Commit c47d3a8

Browse files
SEO: a11y + open external links in new tabs (themesberg#1463)
* chore: improve SEO lighthouse * chore: open external link in new tab * chore: open external link in new tab #2
1 parent d536caf commit c47d3a8

11 files changed

+74
-29
lines changed

apps/web/app/docs/layout.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,8 @@ function DocsNavbar({ isCollapsed, setCollapsed }: DocsLayoutState) {
7070
<HiX aria-label="Close sidebar" className="size-6 cursor-pointer text-gray-600 dark:text-gray-300" />
7171
</button>
7272
)}
73-
<Link href="/" className="sr-only">
74-
Flowbite React
75-
</Link>
76-
<Link
77-
aria-hidden
78-
href="/"
79-
className="flex items-center gap-3 text-2xl font-semibold text-gray-900 dark:text-white"
80-
>
81-
<Image alt="" height={32} src="/favicon.svg" width={32} className="size-8" />
73+
<Link href="/" className="flex items-center gap-3 text-2xl font-semibold text-gray-900 dark:text-white">
74+
<Image alt="Flowbite React logo" src="/favicon.svg" height={32} width={32} className="size-8" />
8275
<span>Flowbite React</span>
8376
</Link>
8477
<div className="hidden lg:ml-[4.5rem] lg:flex">

apps/web/app/layout.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const metadata: Metadata = {
4747
export const viewport: Viewport = {
4848
width: "device-width",
4949
initialScale: 1,
50-
maximumScale: 1,
5150
themeColor: [
5251
{ media: "(prefers-color-scheme: light)", color: "#ffffff" },
5352
{ media: "(prefers-color-scheme: dark)", color: "#1f2937" },

apps/web/components/code-demo.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ function EditOnGithubButton({ githubSlug }: { githubSlug: string }) {
272272
return (
273273
<a
274274
href={href}
275-
rel="noreferrer nofollow noopener"
275+
target="_blank"
276+
rel="nofollow noopener noreferrer"
276277
className="inline-flex w-fit items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-center text-xs font-medium text-gray-900 hover:bg-gray-100 hover:text-primary-700 focus:text-primary-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:text-white dark:focus:ring-gray-700"
277278
>
278279
<svg

apps/web/components/homepage/contributors-section.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export async function ContributorsSection() {
7272
<p>Become a member of a community of developers by supporting Flowbite</p>
7373
</div>
7474
<Link
75+
rel="noopener"
76+
target="_blank"
7577
href="https://github.com/themesberg/flowbite-react"
7678
className="flex items-center gap-2 whitespace-nowrap text-base font-medium text-cyan-700 hover:underline"
7779
>

apps/web/components/homepage/featured-section.tsx

+30-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export function FeaturedSection() {
77
<div className="flex flex-col items-center justify-center gap-2 lg:flex-row lg:gap-8">
88
<div className="mx-auto mb-4 text-base tracking-tight lg:mx-0 lg:mb-0">Featured in:</div>
99
<div className="flex flex-wrap items-center justify-center gap-8">
10-
<Link href="https://www.reddit.com/r/flowbite/" rel="nofollow noreferrer noopener">
10+
<Link
11+
aria-label="Reddit - Flowbite"
12+
href="https://www.reddit.com/r/flowbite/"
13+
rel="nofollow noopener noreferrer"
14+
target="_blank"
15+
>
1116
<svg width="105" height="36" viewBox="0 0 105 36" fill="none" xmlns="http://www.w3.org/2000/svg">
1217
<path
1318
d="M17.727 35.0829C27.2844 35.0829 35.0322 27.3351 35.0322 17.7778C35.0322 8.22043 27.2844 0.472656 17.727 0.472656C8.16966 0.472656 0.421875 8.22043 0.421875 17.7778C0.421875 27.3351 8.16966 35.0829 17.727 35.0829Z"
@@ -27,15 +32,25 @@ export function FeaturedSection() {
2732
/>
2833
</svg>
2934
</Link>
30-
<Link href="https://dev.to/t/flowbite" rel="nofollow noreferrer noopener">
35+
<Link
36+
aria-label="DEV - Flowbite"
37+
href="https://dev.to/t/flowbite"
38+
rel="nofollow noopener noreferrer"
39+
target="_blank"
40+
>
3141
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
3242
<path
3343
d="M9.8811 14.0207C9.57556 13.7923 9.26923 13.6781 8.96369 13.6781H7.59032V21.905H8.96447C9.27002 21.905 9.57634 21.7908 9.88189 21.5624C10.1874 21.334 10.3402 20.9915 10.3402 20.534V15.0492C10.3394 14.5924 10.1859 14.2491 9.8811 14.0207ZM32.244 0.138184H3.87892C1.97321 0.138184 0.4266 1.68086 0.421875 3.58735V31.9682C0.4266 33.8747 1.97321 35.4174 3.87892 35.4174H32.244C34.1505 35.4174 35.6963 33.8747 35.701 31.9682V3.58735C35.6963 1.68086 34.1497 0.138184 32.244 0.138184ZM12.5648 20.5489C12.5648 22.0302 11.6506 24.2745 8.75658 24.2698H5.10266V11.2401H8.83375C11.6246 11.2401 12.5633 13.4813 12.564 14.9633L12.5648 20.5489ZM20.4932 13.5671H16.2975V16.5926H18.8623V18.9212H16.2975V21.9459H20.494V24.2745H15.5974C14.7186 24.2973 13.9878 23.6028 13.9658 22.7239V12.8718C13.9445 11.9937 14.6398 11.2645 15.5179 11.2425H20.494L20.4932 13.5671ZM28.6547 22.646C27.6152 25.0675 25.7528 24.5856 24.9188 22.646L21.8847 11.2433H24.4495L26.7891 20.1985L29.1177 11.2433H31.6833L28.6547 22.646Z"
3444
fill="#6B7280"
3545
/>
3646
</svg>
3747
</Link>
38-
<Link href="https://www.producthunt.com/products/flowbite" rel="nofollow noreferrer noopener">
48+
<Link
49+
aria-label="Product Hunt - Flowbite"
50+
href="https://www.producthunt.com/products/flowbite"
51+
rel="nofollow noopener noreferrer"
52+
target="_blank"
53+
>
3954
<svg width="153" height="36" viewBox="0 0 153 36" fill="none" xmlns="http://www.w3.org/2000/svg">
4055
<path
4156
d="M36.257 17.7779C36.257 27.5959 28.2971 35.5558 18.4791 35.5558C8.65988 35.5558 0.701172 27.5959 0.701172 17.7779C0.701172 7.95871 8.66049 0 18.4791 0C28.2971 0 36.257 7.95932 36.257 17.7779Z"
@@ -51,7 +66,12 @@ export function FeaturedSection() {
5166
/>
5267
</svg>
5368
</Link>
54-
<Link href="https://news.ycombinator.com/item?id=28561468" rel="nofollow noreferrer noopener">
69+
<Link
70+
aria-label="Y Combinator - Flowbite"
71+
href="https://news.ycombinator.com/item?id=28561468"
72+
rel="nofollow noopener noreferrer"
73+
target="_blank"
74+
>
5575
<svg width="161" height="34" viewBox="0 0 161 34" fill="none" xmlns="http://www.w3.org/2000/svg">
5676
<path d="M33.6816 0.226074H0.578125V33.3295H33.6816V0.226074Z" fill="#6B7280" />
5777
<path
@@ -100,7 +120,12 @@ export function FeaturedSection() {
100120
/>
101121
</svg>
102122
</Link>
103-
<Link href="https://www.youtube.com/channel/UC_Ms4V2kYDsh7F_CSsHyQ6A" rel="nofollow noreferrer noopener">
123+
<Link
124+
aria-label="YoutTube - Flowbite"
125+
href="https://www.youtube.com/channel/UC_Ms4V2kYDsh7F_CSsHyQ6A"
126+
rel="nofollow noopener noreferrer"
127+
target="_blank"
128+
>
104129
<svg width="113" height="24" viewBox="0 0 113 24" fill="none" xmlns="http://www.w3.org/2000/svg">
105130
<path
106131
d="M33.6752 3.75529C33.2799 2.28706 32.1223 1.12941 30.6541 0.734118C27.9717 0 17.2423 0 17.2423 0C17.2423 0 6.51292 0 3.83057 0.705882C2.39057 1.10118 1.20469 2.28706 0.809397 3.75529C0.103516 6.43765 0.103516 12 0.103516 12C0.103516 12 0.103516 17.5906 0.809397 20.2447C1.20469 21.7129 2.36234 22.8706 3.83057 23.2659C6.54116 24 17.2423 24 17.2423 24C17.2423 24 27.9717 24 30.6541 23.2941C32.1223 22.8988 33.2799 21.7412 33.6752 20.2729C34.3811 17.5906 34.3811 12.0282 34.3811 12.0282C34.3811 12.0282 34.4094 6.43765 33.6752 3.75529Z"

apps/web/components/homepage/figma-section.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export function FigmaSection() {
2020
<p className="self-stretch">Check out the following resources to learn more about Flowbite Figma:</p>
2121
<div className="isolate flex flex-col items-start gap-4 self-stretch">
2222
<a
23+
rel="nofollow noopener noreferrer"
24+
target="_blank"
2325
href="https://www.figma.com/file/xYaJr6UvThCW2LM2RjLeJf/flowbite-pro-figma-2.6.0?type=design&node-id=18-0&t=jKFrn2Dz5D8jhk7d-0"
2426
className="inline-flex max-w-lg items-center justify-start gap-5 self-stretch rounded-lg border border-gray-300 bg-white px-4 py-3.5 text-center text-base font-medium text-gray-900 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 sm:gap-7 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:hover:border-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
2527
>
@@ -65,6 +67,8 @@ export function FigmaSection() {
6567
</div>
6668
</a>
6769
<a
70+
rel="noopener"
71+
target="_blank"
6872
href="https://flowbite.com/figma/"
6973
className="inline-flex max-w-lg items-center justify-start gap-4 self-stretch rounded-lg border border-gray-300 bg-white px-4 py-3.5 text-center text-base font-medium text-gray-900 placeholder:py-3.5 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 sm:gap-6 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:hover:border-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
7074
>

apps/web/components/homepage/home-navbar.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@ export function HomeNavbar() {
1717
}}
1818
>
1919
<div className="flex items-center gap-3">
20-
<Link href="/" className="sr-only">
21-
Flowbite React
22-
</Link>
23-
<Link
24-
aria-hidden
25-
href="/"
26-
className="flex items-center gap-3 text-2xl font-semibold text-gray-900 dark:text-white"
27-
>
28-
<Image alt="" aria-hidden height="32" src="/favicon.svg" width="32" />
20+
<Link href="/" className="flex items-center gap-3 text-2xl font-semibold text-gray-900 dark:text-white">
21+
<Image alt="Flowbite React logo" src="/favicon.svg" width="32" height="32" className="size-8" />
2922
<span>Flowbite React</span>
3023
</Link>
3124
<div className="ml-4 hidden lg:flex">

apps/web/components/homepage/react-section.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ export function ReactSection() {
3939
React UI components
4040
</h2>
4141
<p className="text-lg text-gray-500 dark:text-gray-400">
42-
<a href="" className="text-lg font-medium text-gray-900 underline hover:no-underline dark:text-white">
42+
<Link
43+
href="/"
44+
className="text-lg font-medium text-gray-900 underline hover:no-underline dark:text-white"
45+
>
4346
Flowbite React
44-
</a>{" "}
47+
</Link>{" "}
4548
is a free and open-source UI component library based on accessible React components and Tailwind CSS.
4649
</p>
4750
<p className="text-lg text-gray-500 dark:text-gray-400">
@@ -78,7 +81,13 @@ export function ReactSection() {
7881
<Button as={Link} href="/docs/getting-started/quickstart">
7982
Start building <HiOutlineArrowRight className="ml-2 size-5" />
8083
</Button>
81-
<Button as={Link} href="https://github.com/themesberg/flowbite-react" color="gray">
84+
<Button
85+
as={Link}
86+
color="gray"
87+
href="https://github.com/themesberg/flowbite-react"
88+
rel="noopener"
89+
target="_blank"
90+
>
8291
View on GitHub
8392
</Button>
8493
</div>

apps/web/components/homepage/social-proof-section.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ export async function SocialProofSection() {
9090
<div className="flex w-full flex-col items-start gap-6 md:gap-3">
9191
<div className="flex flex-row items-start gap-2 self-stretch md:justify-between md:gap-2 md:pr-16 lg:justify-end lg:gap-2 lg:pr-0">
9292
<a
93+
rel="noopener"
94+
target="_blank"
9395
href="https://github.com/themesberg/flowbite-react"
9496
className="flex w-full max-w-[272px] flex-col items-start gap-4 rounded-lg px-4 py-2 text-gray-400 hover:bg-gray-50 lg:px-8 lg:py-6 dark:hover:bg-gray-800"
9597
>
@@ -114,6 +116,8 @@ export async function SocialProofSection() {
114116
</div>
115117
</a>
116118
<a
119+
rel="nofollow noopener noreferrer"
120+
target="_blank"
117121
href="https://www.npmjs.com/package/flowbite-react"
118122
className="flex w-full max-w-[272px] flex-col items-start gap-4 rounded-lg px-4 py-2 text-gray-400 hover:bg-gray-50 lg:px-8 lg:py-6 dark:hover:bg-gray-800"
119123
>
@@ -131,6 +135,8 @@ export async function SocialProofSection() {
131135
</div>
132136
<div className="flex flex-row items-start gap-2 self-stretch md:justify-between md:gap-12 md:pr-16 lg:justify-end lg:gap-2 lg:pr-0">
133137
<a
138+
rel="nofollow noopener noreferrer"
139+
target="_blank"
134140
href="https://www.figma.com/community/file/1179442320711977498"
135141
className="flex w-full max-w-[272px] flex-col items-start gap-4 rounded-lg px-4 py-2 text-gray-400 hover:bg-gray-50 lg:px-8 lg:py-6 dark:hover:bg-gray-800"
136142
>
@@ -169,8 +175,9 @@ export async function SocialProofSection() {
169175
</div>
170176
</a>
171177
<a
178+
rel="nofollow noopener noreferrer"
179+
target="_blank"
172180
href="https://discord.gg/4eeurUVvTy"
173-
rel="nofollow"
174181
className="flex w-full max-w-[272px] flex-col items-start gap-4 rounded-lg px-4 py-2 text-gray-400 hover:bg-gray-50 lg:px-8 lg:py-6 dark:hover:bg-gray-800"
175182
>
176183
<svg

apps/web/components/homepage/tailwind-section.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ export function TailwindSection() {
4343
</p>
4444
<p className="text-lg text-gray-500 dark:text-gray-400">
4545
<a
46+
rel="nofollow noopener noreferrer"
47+
target="_blank"
4648
href="https://tailwindcss.com"
4749
className="text-lg font-medium text-gray-900 underline hover:no-underline dark:text-white"
4850
>
4951
Tailwind CSS
5052
</a>{" "}
5153
is the most popular and open-source utility-first CSS framework on the market and the{" "}
5254
<a
55+
rel="noopener"
56+
target="_blank"
5357
href="https://flowbite.com"
5458
className="text-lg font-medium text-gray-900 underline hover:no-underline dark:text-white"
5559
>

apps/web/components/navbar.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ export function NavbarLinks() {
2121
Quickstart
2222
</a>
2323
<a
24+
rel="noopener"
25+
target="_blank"
2426
href="https://flowbite.com/figma/"
2527
className="rounded-lg p-2.5 text-sm font-medium text-gray-900 hover:text-cyan-700 dark:text-gray-300 dark:hover:text-cyan-500"
2628
>
2729
Figma
2830
</a>
2931
<a
32+
rel="noopener"
33+
target="_blank"
3034
href="https://flowbite.com"
3135
className="rounded-lg p-2.5 text-sm font-medium text-gray-900 hover:text-cyan-700 dark:text-gray-300 dark:hover:text-cyan-500"
3236
>
@@ -48,6 +52,7 @@ export function NavbarIcons() {
4852
rel="noopener"
4953
target="_blank"
5054
href="https://storybook.flowbite-react.com/"
55+
aria-label="View Storybook"
5156
className="hidden rounded-lg p-2.5 text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 lg:block dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
5257
>
5358
<SiStorybook aria-hidden className="size-5" />
@@ -58,6 +63,7 @@ export function NavbarIcons() {
5863
rel="nofollow noopener noreferrer"
5964
target="_blank"
6065
href="https://discord.gg/4eeurUVvTy"
66+
aria-label="Join Discord Community"
6167
className="hidden rounded-lg p-2.5 text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 lg:block dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
6268
>
6369
<SiDiscord aria-hidden className="size-5" />
@@ -68,6 +74,7 @@ export function NavbarIcons() {
6874
rel="noopener"
6975
target="_blank"
7076
href="https://github.com/themesberg/flowbite-react"
77+
aria-label="View on GitHub"
7178
className="hidden rounded-lg p-2.5 text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 lg:block dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
7279
>
7380
<BsGithub aria-hidden className="size-5" />
@@ -80,6 +87,7 @@ export function NavbarIcons() {
8087
rel="nofollow noopener noreferrer"
8188
target="_blank"
8289
href="https://npmjs.com/package/flowbite-react"
90+
aria-label="Toggle dark mode"
8391
className="ml-2 hidden lg:block"
8492
>
8593
<Badge className="bg-primary-50 px-2 text-sm font-medium text-primary-700 hover:bg-primary-600 hover:text-white sm:block lg:block dark:bg-gray-700 dark:text-primary-500 dark:hover:bg-primary-800 dark:hover:text-white">

0 commit comments

Comments
 (0)