Skip to content

Commit

Permalink
Ensure that index.html files are created in directories
Browse files Browse the repository at this point in the history
This is a security requirement of NFSN for direct access.
  • Loading branch information
H0R5E committed May 14, 2024
1 parent c8f393a commit e85b032
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sveltekit-blog-starter",
"version": "2.0.2",
"name": "data-only-greater",
"version": "2.0.1",
"type": "module",
"scripts": {
"build": "vite build",
Expand Down
6 changes: 4 additions & 2 deletions src/routes/blog/+page.server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { postsPerPage } from "$lib/config";

export const trailingSlash = "always";

export const load = async ({ url, fetch }) => {
const postRes = await fetch(`${url.origin}/api/posts.json`);
const posts = await postRes.json();
Expand All @@ -12,14 +14,14 @@ export const load = async ({ url, fetch }) => {
const links = [
{
title: "Latest",
href: "blog",
href: "",
},
];

if (pagesAvailable > 1) {
links.push({
title: "Older",
href: "/blog/page/2",
href: "page/2",
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/routes/blog/page/+page.server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { redirect } from "@sveltejs/kit";

export const trailingSlash = "always";

export const load = () => {
redirect(301, "/blog");
};

0 comments on commit e85b032

Please sign in to comment.