Skip to content

Commit

Permalink
sitemap.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
josephclaytonhansen committed Jan 22, 2024
1 parent 3334813 commit 526c397
Show file tree
Hide file tree
Showing 9 changed files with 537 additions and 471 deletions.
802 changes: 403 additions & 399 deletions dist/assets/index-uBePZDFz.js → dist/assets/index-IUgKibMN.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;700&family=Martel:wght@400;700&family=Fira+Code:wght@400;700&display=swap" rel="preconnect">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
<script type="module" crossorigin src="/assets/index-uBePZDFz.js"></script>
<script type="module" crossorigin src="/assets/index-IUgKibMN.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-haHBJPZ7.css">
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions dist/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://josephhansen.dev/</loc><changefreq>daily</changefreq><priority>0.3</priority></url><url><loc>https://josephhansen.dev/pricing</loc><changefreq>daily</changefreq><priority>0.3</priority></url></urlset>
157 changes: 92 additions & 65 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "vite build",
"preview": "vite preview",
"prepare": "husky install",
"precommit": "cp -r dist/* ../built-josephhansen-dev/built-josephhansen-dev"
"precommit": "cp -r dist/* ../built-josephhansen-dev/built-josephhansen-dev && node sitemap.js"
},
"dependencies": {
"@headlessui/tailwindcss": "^0.2.0",
Expand All @@ -21,6 +21,7 @@
"date-fns": "^3.0.6",
"lucide-vue-next": "^0.303.0",
"pdfvuer": "^2.0.1",
"sitemap": "^7.1.1",
"swiper": "^11.0.5",
"vue": "^3.3.11",
"vue-matomo": "^4.2.0",
Expand Down
1 change: 1 addition & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://josephhansen.dev/</loc><changefreq>daily</changefreq><priority>0.3</priority></url><url><loc>https://josephhansen.dev/pricing</loc><changefreq>daily</changefreq><priority>0.3</priority></url></urlset>
21 changes: 21 additions & 0 deletions sitemap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { SitemapStream, streamToPromise } from "sitemap"
import { createWriteStream } from "fs"
import { routePaths } from "./src/routes.js"

const sitemapStream = new SitemapStream({
hostname: "https://josephhansen.dev",
})

routePaths.forEach((path) => {
sitemapStream.write({
url: `https://josephhansen.dev${path}`,
changefreq: "daily",
priority: 0.3,
})
})

sitemapStream.end()

streamToPromise(sitemapStream).then((data) => {
createWriteStream("./public/sitemap.xml").write(data.toString())
})
13 changes: 8 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createApp } from "vue"
import "./style.css"
import App from "./App.vue"

import Main from "./components/main/Main.vue"

import { createRouter, createWebHistory } from "vue-router"

const routes = [
{ path: "/", component: Main, props: { component: "home" } },
{ path: "/pricing", component: Main, props: { component: "pricing" } },
]
import { routes } from "./routes.js"

routes.forEach((route) => {
route.component = Main
})

const router = createRouter({
history: createWebHistory(),
Expand All @@ -20,3 +21,5 @@ const app = createApp(App)
app.use(router)

app.mount("#app")

export { routes }
8 changes: 8 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const routes = [
{ path: "/", component: null, props: { component: "home" } },
{ path: "/pricing", component: null, props: { component: "pricing" } },
]

const routePaths = routes.map((route) => route.path)

export { routes, routePaths }

0 comments on commit 526c397

Please sign in to comment.