Skip to content

Commit 850d2a5

Browse files
authored
Merge pull request #500 from processing/fix/paths
Try to fix link path issues
2 parents eb88176 + e5bb9a7 commit 850d2a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+184
-120
lines changed

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default defineConfig({
5050
defaultStrategy: "viewport",
5151
prefetchAll: true,
5252
},
53-
trailingSlash: "ignore",
53+
trailingSlash: "always",
5454
build: {
5555
format: "directory",
5656
},

src/components/GridItem/ContributorDoc.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const { item } = Astro.props;
1111

1212
<a
1313
class="group hover:no-underline"
14-
href={`/contribute/${removeLocaleAndExtension(item.slug)}`}
14+
href={`/contribute/${removeLocaleAndExtension(item.slug)}/`}
1515
>
1616
<div
1717
class="grid place-content-center bg-accent-color text-accent-type-color aspect-photo p-4"

src/components/GridItem/Event.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const dayString = new Date(item.data.date).toLocaleDateString(currentLocale, {
1919

2020
<a
2121
class="group hover:no-underline"
22-
href={`/events/${removeLocaleAndExtension(item.slug)}`}
22+
href={`/events/${removeLocaleAndExtension(item.slug)}/`}
2323
>
2424
<!-- Could potentially reduce width needed here if featured and non-featured events were distinguished -->
2525
<Image

src/components/GridItem/Example.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { item, lazyLoad } = Astro.props;
1313

1414
<a
1515
class="group hover:no-underline"
16-
href={`/examples/${exampleContentSlugToLegacyWebsiteSlug(item.slug)}`}
16+
href={`/examples/${exampleContentSlugToLegacyWebsiteSlug(item.slug)}/`}
1717
>
1818
<Image
1919
src={item.data.featuredImage}

src/components/GridItem/Reference.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const { item } = Astro.props;
1111

1212
<a
1313
class="group hover:no-underline"
14-
href={`/reference/${normalizeReferenceRoute(item.id)}`}
14+
href={`/reference/${normalizeReferenceRoute(item.id)}/`}
1515
>
1616
<p
1717
class="text-body mt-xs text-body-mono break-words break-keep group-hover:underline"

src/components/GridItem/Sketch.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const height = Math.min(
2323

2424
<a
2525
class="group w-full h-full block hover:no-underline"
26-
href={`/sketches/${item.visualID}`}
26+
href={`/sketches/${item.visualID}/`}
2727
>
2828
{
2929
// This isn't alt text ideal but we have no way of knowing what

src/components/GridItem/Tutorial.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface Props {
1010
const { item, lazyLoad } = Astro.props;
1111
---
1212

13-
<a href={`/tutorials/${item.slug}`} class="group hover:no-underline">
13+
<a href={`/tutorials/${item.slug}/`} class="group hover:no-underline">
1414
{
1515
item.data.featuredImageAlt && item.data.featuredImage && (
1616
<Image
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
import { rewriteRelativeLink } from "@pages/_utils";
3+
const rawProps = Astro.props;
4+
const props = { ...rawProps };
5+
if (props.href) {
6+
props.href = rewriteRelativeLink(props.href);
7+
}
8+
---
9+
10+
<a {...props}><slot /></a>

src/components/Nav/MainNavLinks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const MainNavLinks = ({
9090
</a>
9191
</li>
9292
<li>
93-
<a className={styles.buttonlink} href="/donate">
93+
<a className={styles.buttonlink} href="/donate/">
9494
<div class="mr-xxs">
9595
<Icon kind="heart" />
9696
</div>

src/components/Nav/index.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const isHomepage = pathMinusLocale === "/";
1111
const t = await getUiTranslator(currentLocale);
1212
1313
const mainLinks = [
14-
{ url: "/reference", label: t("Reference") },
15-
{ url: "/tutorials", label: t("Tutorials") },
16-
{ url: "/examples", label: t("Examples") },
17-
{ url: "/contribute", label: t("Contribute") },
18-
{ url: "/community", label: t("Community") },
19-
{ url: "/about", label: t("About") },
14+
{ url: "/reference/", label: t("Reference") },
15+
{ url: "/tutorials/", label: t("Tutorials") },
16+
{ url: "/examples/", label: t("Examples") },
17+
{ url: "/contribute/", label: t("Contribute") },
18+
{ url: "/community/", label: t("Community") },
19+
{ url: "/about/", label: t("About") },
2020
] as { url: string; label: string }[];
2121
2222
const editorButtonLabel = t("Start Coding");

0 commit comments

Comments
 (0)