Skip to content

trailingSlash has no effect on URLs on blog feeds #7656

Description

@ilarischeinin

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

My deployment (nginx-s3 ingress) requires trailing slashes, so I'm using trailingSlash: true. This works for URLs on the web pages, but the ones in blog feeds (RSS and Atom) do not get a trailing slash and therefore do not work.

Reproducible demo

No response

Steps to reproduce

# create a new site and build
npx create-docusaurus@latest reprex classic
cd reprex
npm run build

# links to an example blog post are without a trailing slash, both in index.html:
grep -o ".......blog/welcome.." build/blog/index.html
# href="https://github.com/blog/welcome">
# href="https://github.com/blog/welcome">

# and in the RSS and Atom feeds:
grep -o ".......blog/welcome.." build/blog/rss.xml
# te.com/blog/welcome</
grep -o ".......blog/welcome.." build/blog/atom.xml
# te.com/blog/welcome"/

# add 'trailingSlash: true' to the config and re-build
gsed -i '12 a\  trailingSlash: true,' docusaurus.config.js
npm run build

# now links in index.html are with the trailing slash:
grep -o ".......blog/welcome.." build/blog/index.html
# href="https://github.com/blog/welcome/"
# href="https://github.com/blog/welcome/"

# but the RSS and Atom feed ones are still without a trailing slash:
grep -o ".......blog/welcome.." build/blog/rss.xml
# te.com/blog/welcome</
grep -o ".......blog/welcome.." build/blog/atom.xml
# te.com/blog/welcome"/

Expected behavior

URLs on both the web pages and the feeds respect the trailingSlash setting.

Actual behavior

Web pages are affected by trailingSlash but feeds are not.

Your environment

  • Docusaurus version used: 2.0.0-beta.21
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node v18.3.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Big Sur 11.6.5

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: trailing slashRelated to trailing slash config

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions