Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/docs/src/components/content-nav/content-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usePage, usePageIndex, PageIndex } from '@builder.io/qwik-city';
import { component$, Host, useHostElement, useScopedStyles$ } from '@builder.io/qwik';
import { component$, Host, useScopedStyles$ } from '@builder.io/qwik';
import styles from './content-nav.css?inline';

export const ContentNav = component$(
Expand Down Expand Up @@ -27,7 +27,9 @@ export const ContentNav = component$(
};
readIndex(pageIndex);

const current = pageOrder.findIndex((p) => p.href === page.url.pathname);
const current = pageOrder.findIndex(
(p) => p.href === new URL(page.url, 'https://qwik.builder.io/').pathname
);
if (current > -1) {
let prev = pageOrder[current - 1];
if (prev && prev.href) {
Expand Down
6 changes: 4 additions & 2 deletions packages/docs/src/components/page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Examples from '../../layouts/examples/examples';

export const Page = component$(() => {
const doc = useDocument();

const loc = getLocation(doc);

if (loc.pathname === '/playground') {
return <Playground />;
}
Expand All @@ -29,7 +29,9 @@ export const Page = component$(() => {
description: attrs.description,
});

setHeadLinks(doc, [{ rel: 'canonical', href: page.url.href }]);
setHeadLinks(doc, [
{ rel: 'canonical', href: new URL(page.url, 'https://qwik.builder.io/').href },
]);

return (
<Layout>
Expand Down
5 changes: 4 additions & 1 deletion packages/docs/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export const SideBar = component$(
<li>
<a
href={item.href}
class={{ 'is-active': new URL(page.url).pathname === item.href }}
class={{
'is-active':
new URL(page.url, 'https://qwik.builder.io/').pathname === item.href,
}}
>
{item.text}
</a>
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/src/runtime/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const useQwikCity = () => {
headings: loaded.headings,
index: loaded.index,
source: loaded.source,
url: loaded.url.href,
url: loaded.url,
content: noSerialize(loaded.content),
layout: noSerialize(loaded.layout),
});
Expand Down Expand Up @@ -91,6 +91,6 @@ const loadPage = async (href: string): Promise<PageHandler | null> => {
index: pageModule.index,
layout: layoutModule,
source: pageModule.source,
url,
url: url.pathname,
};
};
2 changes: 1 addition & 1 deletion packages/qwik-city/src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface PageHandler {
index: { path: string };
layout: Layout;
source: PageSource;
url: URL;
url: string;
}

/**
Expand Down