Skip to content

Commit

Permalink
Merge pull request #20 from azachwill/devcommit22
Browse files Browse the repository at this point in the history
hello
  • Loading branch information
awilliams1275 authored Aug 19, 2024
2 parents a6ff902 + dc836de commit 02bb58b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions netlify/edge-functions/hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ export default async (request, context) => {
// Remove the trailing slash and add .html extension
const newPathname = url.pathname.slice(0, -1) + '.html';
const newUrl = `${url.origin}${newPathname}${url.search}`;

}
else if ( url.pathname.endsWith('/index.html'))
{
// Remove the trailing slash and add .html extension
const newPathname = url.pathname.slice(0, -1) + 'index.html';
const newUrl = `${url.origin}${newPathname}`;
}

else {
const newUrl = url.pathname ;
}
{
// Perform a 301 redirect
return new Response(null, {
status: 301,
Expand All @@ -21,6 +32,6 @@ export default async (request, context) => {
};

export const config = {
path: '/py/docs/*',
path: '/*',
};

0 comments on commit 02bb58b

Please sign in to comment.