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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
node_modules/
dist/
.astro/

# OG image must ship despite the *.png rule
!public/assets/img/logo/traverse_icon_1024x1024.png
13 changes: 13 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
site: 'https://traverse-framework.com',
Expand All @@ -7,4 +8,16 @@ export default defineConfig({
format: 'file',
},
trailingSlash: 'never',
integrations: [
sitemap({
serialize(item) {
// build.format 'file' emits .html pages; make sitemap URLs match canonicals
const url = new URL(item.url);
if (url.pathname !== '/' && !url.pathname.endsWith('.html')) {
item.url = `${url.origin}${url.pathname}.html`;
}
return item;
},
}),
],
});
76 changes: 76 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/sitemap": "^3.7.3",
"astro": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
User-agent: *
Allow: /

Sitemap: https://traverse-framework.com/sitemap.xml
Sitemap: https://traverse-framework.com/sitemap-index.xml
30 changes: 28 additions & 2 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,31 @@ const {
description,
canonical = Astro.url.href,
jsonLd,
ogImage = '/assets/img/og-default.png',
ogImage = '/assets/img/logo/traverse_icon_1024x1024.png',
} = Astro.props;

const fullTitle = title.includes('Traverse') ? title : `${title} — Traverse Framework`;
const ogImageAbs = new URL(ogImage, Astro.site).href;

const siteJsonLd = JSON.stringify({
'@context': 'https://schema.org',
'@graph': [
{
'@type': 'Organization',
'@id': 'https://traverse-framework.com/#organization',
name: 'Traverse Framework',
url: 'https://traverse-framework.com/',
logo: 'https://traverse-framework.com/assets/img/logo/traverse_icon_512x512.svg',
},
{
'@type': 'WebSite',
'@id': 'https://traverse-framework.com/#website',
name: 'Traverse Framework',
url: 'https://traverse-framework.com/',
publisher: { '@id': 'https://traverse-framework.com/#organization' },
},
],
});
---
<!doctype html>
<html lang="en" data-theme="dark">
Expand All @@ -35,8 +56,12 @@ const fullTitle = title.includes('Traverse') ? title : `${title} — Traverse Fr
<meta property="og:title" content={fullTitle}>
<meta property="og:description" content={description}>
<meta property="og:url" content={canonical}>
<meta property="og:image" content={ogImage}>
<meta property="og:site_name" content="Traverse Framework">
<meta property="og:image" content={ogImageAbs}>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content={fullTitle}>
<meta name="twitter:description" content={description}>
<meta name="twitter:image" content={ogImageAbs}>

<!-- Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z2T980YV3P"></script>
Expand All @@ -48,6 +73,7 @@ const fullTitle = title.includes('Traverse') ? title : `${title} — Traverse Fr
</script>

<!-- Structured data -->
<script type="application/ld+json" set:html={siteJsonLd} />
{jsonLd && <script type="application/ld+json" set:html={jsonLd} />}

<!-- Favicons -->
Expand Down
Loading