TryGhost / gatsby-plugin-advanced-sitemap

Advanced XML Sitemaps for Gatsby.js
MIT License
150 stars 0 forks source link

Incorrect link to sitemap.xsl when using custom output path #239

Open jakub-bujakowski opened 1 year ago

jakub-bujakowski commented 1 year ago

Issue Summary

This issue occurs both locally on iOS & also in CI/CD environment (in my case TeamCity). It looks like the plugin always generates the sitemap.xsl file in the root folder and doesn't respect the output path for sitemap.xml.

This is my plugin config in gatsby-config file:

{
      resolve: "gatsby-plugin-advanced-sitemap",
      options: {
        output: `${process.env.GATSBY_ASSET_PATH}sitemap/sitemap-index.xml`,
        excludes: [
          "/global/*",
          "/5xx",
          "/*/404",
          "/preview",
        ],
        additionalSitemaps: [
            {
              name: `blog`,
              url: `/blog/sitemap.xml`,
            },
        ],
      },
},

The process.env.GATSBY_ASSET_PATH variable is set to /assets/gtsb/

When I build production I get this file structure:

│   sitemap.xsl
└───assets
│   └───gtsb
│       │   sitemap-pages.xml
│       │   sitemap.xml

Inside of sitemap.xml the stylesheet href points to sitemap.xsl instead of ../../sitemap.xsl resulting in 404 for sitemap.xsl.

Is there any way to fix the href link or copy the .xsl file to my output path?

To Reproduce

  1. In the plugin config options provide custom output path

Result: Only the .xml files get copied to that output, the .xsl file is generated in the root. The .xml file contains

Expected Result: Both files are copied to output path

Technical details:

michalstolarski-batmaid commented 1 year ago

+1