Skip to content

Commit 3be884e

Browse files
authored
Merge pull request #46 from ibelem/seo-1
SEO Improvements
2 parents 9170ee5 + dab9d7a commit 3be884e

File tree

11 files changed

+283
-47
lines changed

11 files changed

+283
-47
lines changed

app/[lang]/layout.jsx

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,48 @@ import 'nextra-theme-docs/style.css'
77
import '../style.css'
88

99
export const metadata = {
10-
description:
11-
'WebNN, WebNN Neural Network API',
10+
description: 'WebNN, WebNN Neural Network API',
1211
title: {
1312
absolute: 'WebNN',
1413
template: '%s | WebNN · Web Neural Network API'
1514
},
1615
metadataBase: new URL('https://webnn.io'),
1716
openGraph: {
18-
images:
19-
'https://webnn.io/android-chrome-512x512.png'
17+
type: 'website',
18+
siteName: 'WebNN',
19+
url: 'https://webnn.io',
20+
title: 'WebNN · Web Neural Network API',
21+
description: 'WebNN, a new web standard that allows web apps and frameworks to accelerate deep neural networks with on-device hardware such as GPUs, CPUs, or purpose-built AI accelerators. WebNN is currently the only web API that enables NPU access.',
22+
images: [
23+
{
24+
url: 'https://webnn.io/android-chrome-512x512.png',
25+
width: 512,
26+
height: 512,
27+
alt: 'WebNN Logo',
28+
}
29+
],
30+
locale: 'en_US',
2031
},
2132
twitter: {
22-
site: '@webmachinelearning'
33+
card: 'summary_large_image',
34+
site: '@ibelem',
35+
title: 'WebNN · Web Neural Network API',
36+
description: 'WebNN, a new web standard that allows web apps and frameworks to accelerate deep neural networks with on-device hardware such as GPUs, CPUs, or purpose-built AI accelerators. WebNN is currently the only web API that enables NPU access.',
37+
images: ['https://webnn.io/android-chrome-512x512.png'],
2338
},
2439
appleWebApp: {
2540
title: 'WebNN'
2641
},
2742
other: {
2843
'msapplication-TileColor': '#fff'
29-
}
44+
},
45+
alternates: {
46+
canonical: './',
47+
languages: {
48+
'en': '/en',
49+
'zh': '/zh',
50+
},
51+
},
3052
}
3153

3254
const navbar = (
@@ -214,6 +236,36 @@ export default async function RootLayout({ children, params }) {
214236
{/* Your additional tags should be passed as `children` of `<Head>` element */}
215237
</Head>
216238
<body>
239+
<script
240+
type="application/ld+json"
241+
dangerouslySetInnerHTML={{
242+
__html: JSON.stringify({
243+
"@context": "https://schema.org",
244+
"@graph": [
245+
{
246+
"@type": "WebSite",
247+
"name": "WebNN",
248+
"url": "https://webnn.io",
249+
"potentialAction": {
250+
"@type": "SearchAction",
251+
"target": "https://webnn.io/search?q={search_term_string}",
252+
"query-input": "required name=search_term_string"
253+
}
254+
},
255+
{
256+
"@type": "Organization",
257+
"name": "Web Machine Learning",
258+
"url": "https://webnn.io",
259+
"logo": "https://webnn.io/android-chrome-512x512.png",
260+
"sameAs": [
261+
"https://github.com/webmachinelearning",
262+
"https://x.com/ibelem"
263+
]
264+
}
265+
]
266+
})
267+
}}
268+
/>
217269
<Layout
218270
banner={
219271
<Banner storageKey="webnn-announcement">

app/[lang]/playground/litert/[slug]/page.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client"
22

3+
import { GoogleAnalytics } from '@next/third-parties/google'
34
import React, { useState, useEffect } from 'react';
45
import { Sandpack } from "@codesandbox/sandpack-react";
56
import { useTheme } from 'nextra-theme-docs';
@@ -59,6 +60,8 @@ export default function Page() {
5960
};
6061

6162
return (
63+
<>
64+
<GoogleAnalytics gaId="G-0MBRQQNHVC" />
6265
<div>
6366
<div className="md:px-8 xl:px-8 mb-8">
6467
<div className="mx-1 md:mx-0 playground-nav">
@@ -194,6 +197,8 @@ export default function Page() {
194197
files={files}
195198
/>
196199
</div>
200+
<GoogleAnalytics gaId="G-0MBRQQNHVC" />
197201
</div>
202+
</>
198203
)
199204
}

app/[lang]/playground/onnxruntime/[slug]/page.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client"
22

3+
import { GoogleAnalytics } from '@next/third-parties/google'
34
import React, { useState, useEffect } from 'react';
45
import { Sandpack } from "@codesandbox/sandpack-react";
56
import { useTheme } from 'nextra-theme-docs';
@@ -59,6 +60,7 @@ export default function Page() {
5960
};
6061

6162
return (
63+
<>
6264
<div>
6365
<div className="md:px-8 xl:px-8 mb-8">
6466
<div className="mx-1 md:mx-0 playground-nav">
@@ -194,6 +196,8 @@ export default function Page() {
194196
files={files}
195197
/>
196198
</div>
199+
<GoogleAnalytics gaId="G-0MBRQQNHVC" />
197200
</div>
201+
</>
198202
)
199203
}

app/[lang]/playground/transformersjs/[slug]/page.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client"
22

3+
import { GoogleAnalytics } from '@next/third-parties/google'
34
import React, { useState, useEffect } from 'react';
45
import { Sandpack } from "@codesandbox/sandpack-react";
56
import { useTheme } from 'nextra-theme-docs';
@@ -60,6 +61,7 @@ export default function Page() {
6061
};
6162

6263
return (
64+
<>
6365
<div>
6466
<div className="md:px-8 xl:px-8 mb-8">
6567
<div className="mx-1 md:mx-0 playground-nav">
@@ -195,6 +197,8 @@ export default function Page() {
195197
files={files}
196198
/>
197199
</div>
200+
<GoogleAnalytics gaId="G-0MBRQQNHVC" />
198201
</div>
202+
</>
199203
)
200204
}

app/[lang]/playground/webnn/[slug]/page.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client"
22

3+
import { GoogleAnalytics } from '@next/third-parties/google'
34
import React, { useState, useEffect } from 'react';
45
import { Sandpack } from "@codesandbox/sandpack-react";
56
import { useTheme } from 'nextra-theme-docs';
@@ -60,6 +61,7 @@ export default function Page() {
6061
};
6162

6263
return (
64+
<>
6365
<div>
6466
<div className="md:px-8 xl:px-8 mb-8">
6567
<div className="mx-1 md:mx-0 playground-nav">
@@ -195,6 +197,8 @@ export default function Page() {
195197
files={files}
196198
/>
197199
</div>
200+
<GoogleAnalytics gaId="G-0MBRQQNHVC" />
198201
</div>
202+
</>
199203
)
200204
}

middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ export { middleware } from 'nextra/locales'
33
export const config = {
44
// Matcher ignoring `/_next/`, `/api/`, and static files like `llms.txt` and the `netron` folder
55
matcher: [
6-
'/((?!api|_next/static|_next/image|favicon.ico|icon.svg|apple-icon.png|manifest|_pagefind|llms.txt|netron|demos).*)'
6+
'/((?!api|_next/static|_next/image|favicon.ico|icon.svg|apple-icon.png|android-chrome-512x512.png|manifest|_pagefind|llms.txt|netron|demos|robots.txt|sitemap.xml).*)'
77
]
88
}

next-sitemap.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('next-sitemap').IConfig} */
2+
module.exports = {
3+
siteUrl: 'https://webnn.io',
4+
generateRobotsTxt: false,
5+
generateIndexSitemap: false,
6+
outDir: 'public',
7+
exclude: ['/icon.svg', '/apple-icon.png', '/manifest.webmanifest', '/twitter-image.png', '/opengraph-image.png'],
8+
}

0 commit comments

Comments
 (0)