Skip to content

Commit 9d7e0e1

Browse files
committed
Fix sitemap reference and add 404 page
1 parent 8b6a041 commit 9d7e0e1

4 files changed

Lines changed: 53 additions & 4 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sitemap from '@astrojs/sitemap';
44
export default defineConfig({
55
site: 'https://simplebytes.com',
66
integrations: [sitemap({
7-
filter: (page) => !page.includes('/v/'),
7+
filter: (page) => !page.includes('/v/') && !page.includes('/404'),
88
})],
99
build: {
1010
assets: '_assets'

public/robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
User-agent: *
22
Allow: /
33

4-
Sitemap: https://simplebytes.com/sitemap.xml
4+
Sitemap: https://simplebytes.com/sitemap-index.xml

src/layouts/BaseLayout.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ interface Props {
88
description?: string;
99
image?: string;
1010
structuredData?: Record<string, unknown> | Record<string, unknown>[];
11+
noindex?: boolean;
1112
}
1213
1314
const {
1415
title,
1516
description = "A portfolio of digital products creating tiny, easy to use tools for better productivity and focus.",
1617
image = "/img/og-image.png",
17-
structuredData: pageStructuredData
18+
structuredData: pageStructuredData,
19+
noindex = false
1820
} = Astro.props;
1921
2022
const canonicalURL = new URL(Astro.url.pathname, "https://simplebytes.com");
@@ -46,7 +48,7 @@ const structuredDataItems = [
4648
<title>{title}</title>
4749
<meta name="description" content={description}>
4850
<meta name="author" content="Simple Bytes">
49-
<meta name="robots" content="index, follow">
51+
<meta name="robots" content={noindex ? "noindex, follow" : "index, follow"}>
5052
<link rel="canonical" href={canonicalURL}>
5153

5254
<!-- Open Graph -->

src/pages/404.astro

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
import BaseLayout from '../layouts/BaseLayout.astro';
3+
---
4+
5+
<BaseLayout
6+
title="Page not found - Simple Bytes"
7+
description="This Simple Bytes page could not be found."
8+
noindex
9+
>
10+
<section class="not-found" aria-labelledby="not-found-heading">
11+
<p class="section-label">404</p>
12+
<h1 id="not-found-heading">Page not found</h1>
13+
<p class="tagline">This page does not exist, or it may have moved.</p>
14+
<div class="cta-row">
15+
<a href="/" class="btn btn--primary">Go home</a>
16+
<a href="/projects" class="btn btn--secondary">Browse projects</a>
17+
</div>
18+
</section>
19+
</BaseLayout>
20+
21+
<style>
22+
.not-found {
23+
max-width: 560px;
24+
padding: 5rem 0;
25+
}
26+
27+
h1 {
28+
color: var(--text-primary);
29+
font-size: clamp(2rem, 5vw, 2.75rem);
30+
font-weight: 600;
31+
line-height: 1.2;
32+
margin: 0 0 1rem;
33+
}
34+
35+
.tagline {
36+
color: var(--text-secondary);
37+
font-size: 1.125rem;
38+
line-height: 1.6;
39+
margin: 0 0 1.75rem;
40+
}
41+
42+
.cta-row {
43+
display: flex;
44+
flex-wrap: wrap;
45+
gap: 0.75rem;
46+
}
47+
</style>

0 commit comments

Comments
 (0)