Skip to content

Commit

Permalink
fix: imrpve route scroll, add clean urls
Browse files Browse the repository at this point in the history
  • Loading branch information
silvester-pari committed Nov 14, 2024
1 parent c5aaa3a commit e2bf0f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { config } from "https://hub-brands.eox.at/gtif-austria/config.mjs";
export default defineConfig({
appearance: false,
lastUpdated: true,
cleanUrls: true,
sitemap: {
hostname: "https://gtif-austria.info",
},
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/narratives.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default createContentLoader("narratives/*.md", {
render: true,
transform(rawData) {
return rawData.filter(
(d) => d.url !== "/narratives/" && d.url !== "/narratives/README.html",
(d) => d.url !== "/narratives/" && d.url !== "/narratives/README",
);
},
});
8 changes: 7 additions & 1 deletion .vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
if (
to.includes("/narratives/") &&
to !== "/narratives/" &&
to !== "/narratives/README.html"
to !== "/narratives/README"
) {
router.route.data = {
content: narratives.find((n) => n.url === to).src,
Expand All @@ -28,6 +28,12 @@ export default {
return true;
};

router.onAfterRouteChanged = () => {
if (window) {
window.scrollTo(0, 0);
}
};

if (!import.meta.env.SSR) {
const { primaryColor } = siteData.value.themeConfig;

Expand Down

0 comments on commit e2bf0f9

Please sign in to comment.