diff --git a/packages/docs/src/components/router-head/router-head.tsx b/packages/docs/src/components/router-head/router-head.tsx
index 67f51ef7173..5ab6de96fa8 100644
--- a/packages/docs/src/components/router-head/router-head.tsx
+++ b/packages/docs/src/components/router-head/router-head.tsx
@@ -1,12 +1,14 @@
-import { component$ } from '@qwik.dev/core';
-import { useDocumentHead, useLocation } from '@qwik.dev/router';
+import { component$, untrack } from '@qwik.dev/core';
+import { DocumentHeadTags, useDocumentHead, useLocation } from '@qwik.dev/router';
import { Social } from './social';
-import { InjectThemeScript } from '../theme-toggle';
import { Vendor } from './vendor';
+/** The dynamic head content */
export const RouterHead = component$(() => {
- const { url } = useLocation();
const head = useDocumentHead();
+ const { url } = useLocation();
+ const href = head.frontmatter?.canonical || untrack(() => url.href);
+
const title = head.title
? `${head.title} 📚 Qwik Documentation`
: `Qwik - Framework reimagined for the edge`;
@@ -47,45 +49,23 @@ export const RouterHead = component$(() => {
}
},
};
-
return (
<>
-
s.name !== 'description')
- .map((m, key) => (
-
- ))}
-
- {head.links.map((l, key) => (
-
- ))}
-
- {head.styles.map((s, key) => (
-
- ))}
-
-
+ meta={head.meta.filter((s) => s.name !== 'description')}
+ />
>
);
});
diff --git a/packages/docs/src/repl/ui/repl-commands.tsx b/packages/docs/src/repl/ui/repl-commands.tsx
index 5cde8113056..6d18aaa7072 100644
--- a/packages/docs/src/repl/ui/repl-commands.tsx
+++ b/packages/docs/src/repl/ui/repl-commands.tsx
@@ -1,11 +1,7 @@
import { createPlaygroundShareUrl } from './repl-share-url';
import type { ReplAppInput } from '../types';
-export const ReplCommands = ({
- input,
- enableCopyToPlayground,
- enableDownload,
-}: ReplCommandProps) => {
+export const ReplCommands = ({ input, enableCopyToPlayground }: ReplCommandProps) => {
return (
{enableCopyToPlayground ? (
diff --git a/packages/docs/src/root.tsx b/packages/docs/src/root.tsx
index cd89a8393f4..c3968b4af42 100644
--- a/packages/docs/src/root.tsx
+++ b/packages/docs/src/root.tsx
@@ -1,18 +1,10 @@
import { component$, useContextProvider, useStore } from '@qwik.dev/core';
import { Insights } from '@qwik.dev/core/insights';
-import {
- RouterOutlet,
- ServiceWorkerRegister,
- useDocumentHead,
- useLocation,
- useQwikRouter,
-} from '@qwik.dev/router';
-import RealMetricsOptimization from './components/real-metrics-optimization/real-metrics-optimization';
-import { Social } from './components/router-head/social';
-import { Vendor } from './components/router-head/vendor';
+import { RouterOutlet, useQwikRouter } from '@qwik.dev/router';
+import { RouterHead } from './components/router-head/router-head';
import { InjectThemeScript } from './components/theme-toggle';
-import { BUILDER_PUBLIC_API_KEY } from './constants';
import { GlobalStore, type SiteStore } from './context';
+
import './global.css';
export const uwu = /*javascript*/ `
@@ -50,8 +42,6 @@ export const uwu = /*javascript*/ `
export default component$(() => {
useQwikRouter();
- const head = useDocumentHead();
- const { url } = useLocation();
const store = useStore({
headerMenuOpen: false,
@@ -62,55 +52,11 @@ export default component$(() => {
useContextProvider(GlobalStore, store);
- const title = head.title
- ? `${head.title} 📚 Qwik Documentation`
- : `Qwik - Framework reimagined for the edge`;
- const description =
- head.meta.find((m) => m.name === 'description')?.content ||
- `No hydration, auto lazy-loading, edge-optimized, and fun 🎉!`;
-
- const OGImage = {
- imageURL: '',
- ogImgTitle: '',
- ogImgSubTitle: '' as string | undefined,
-
- get URL() {
- //turn the title into array with [0] -> Title [1] -> subTitle
- const arrayedTitle = title.split(' | ');
- const ogImageUrl = new URL('https://opengraphqwik.vercel.app/api/og?level=1');
-
- // biggerTitle
- this.ogImgTitle = arrayedTitle[0];
- //smallerTitle
- this.ogImgSubTitle = arrayedTitle[1]
- ? arrayedTitle[1].replace(' 📚 Qwik Documentation', '')
- : undefined;
-
- //decide whether or not to show dynamic OGimage or use docs default social card
- if (this.ogImgSubTitle == undefined || this.ogImgTitle == undefined) {
- this.imageURL = new URL(`/logos/social-card.jpg`, url).href;
-
- return this.imageURL;
- } else {
- ogImageUrl.searchParams.set('title', this.ogImgTitle);
- ogImageUrl.searchParams.set('subtitle', this.ogImgSubTitle);
- // ogImageUrl.searchParams.set('level', this.routeLevel.toString());
-
- this.imageURL = ogImageUrl.toString();
-
- return this.imageURL;
- }
- },
- };
-
return (
<>
- {title}
-
-
@@ -121,38 +67,11 @@ export default component$(() => {
- {import.meta.env.PROD && (
- <>
-
-
- >
- )}
-
- {/* The below are tags that were collected from all the `head` exports in the current route. */}
- {head.meta
- // Skip description because that was already added at the top
- .filter((s) => s.name !== 'description')
- .map((m, key) => (
-
- ))}
-
- {head.links.map((l, key) => (
-
- ))}
-
- {head.styles.map((s, key) => (
-
- ))}
-
- {head.scripts.map((s, key) => (
-
- ))}
+
-
-
@@ -164,7 +83,6 @@ export default component$(() => {
>
{/* This renders the current route, including all Layout components. */}
-