Skip to content

devotox/slash-edge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strip or add trailing slash

Banish or enforce trailing slashes with Netlify edge functions. Demo

Usage

You can either manually copy the function, or import it from a URL.

Manual

Copy the appropriate function from /lib/ to your site's /netlify/edge-functions/ directory.

Import from URL

Create a handler your site's /netlify/edge-functions/ directory and export the function from deno.land/x:

// /netlify/edge-functions/strip-slash.ts

export { stripSlash as default } from 'https://deno.land/x/slash_handler/mod.ts'

After creating the function, you then need to add a declaration to your site's netlify.toml:

[[edge_functions]]
function = "strip-slash" # or "add-slash"
path = "/*"

Licence: MIT

About

Banish or add trailing slashes with a Netlify edge function

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 70.1%
  • TypeScript 29.9%