Skip to content

configuration option for trailing forward slash #1176

Description

@thescientist13

Type of Change

Coming out of #1116 , one thing that will be useful to have a configuration option for is the trailing forward slash in a URL, e.g.

  • http://www.example.com/about
  • http://www.example.com/about/

Different web hosts / servers threat this differently, and not sure if there is also a "canonical" way of instrumenting this, or if it's mostly just for convenience / vanity?

Currently Greenwood assumes / sets a trailing forward slash automatically.

Summary

So the need here would be to enable a configuration option, e.g.

// greenwood.config.js
export default {
  trailingForwardSlash: true|false // default is true
}

At the very least it should be supported in all instances basePath were supported in

  1. The graph
  2. Pages (static and SSR routing)
  3. API Routes
  4. Adapters (splat, dynamic routing, etc)
  5. GraphQL / Content as data

This post may be worth reading - https://bjornlu.com/blog/trailing-slash-for-frameworks

Metadata

Metadata

Assignees

No one assigned

    Labels

    AdapterCLIPluginsGreenwood PluginsTypes(cript)Requires type definition or TypeScript related work / documentationdocumentationGreenwood specific docsfeatureNew feature or request
    No fields configured for Feature.

    Projects

    Status
    🔖 Ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions