Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap Breaks When Exceeding Limit and Strapi Port Differs from Default #160

Closed
101sam opened this issue Feb 13, 2024 · 4 comments
Closed

Comments

@101sam
Copy link

101sam commented Feb 13, 2024

Bug report

Sitemap Breaks When Exceeding Limit and Strapi Port Differs from Default

Describe the bug

Plugin default value:
Limit: 45000 breaks to pages

Sitemap URL | Last modification date
-- | --
http://localhost:1337/api/sitemap/index.xml?page=1 |  
http://localhost:1337/api/sitemap/index.xml?page=2 |  
http://localhost:1337/api/sitemap/index.xml?page=3 |  

When crossing the limit, the site map is broken.

Steps to reproduce the behavior

  1. env define port any - not default
  2. config/plugin.[ts]/[js] change limit to 2 to force creating multi-pages
  3. Re-Run Strapi
  4. Click on Generate sitemap
  5. Click [Go to the sitemap]
  6. see the error

Expected behavior

Pointing to: HTTP[s]://DOMAIN:PORT/api/sitemap/index.xml?page=n

However, the preferred results should be (like in our case API server and front end not using the same domain):

Instead of using page=n you should use

In our case, A Full URL
Pointing to: http://DOMAIN:4337/api/sitemap/[page]/index.xml

Error Screenshots

image

Code snippets

plugin config

---
'sitemap': {
    enabled: true,
    config: {
      cron: '0 0 0 * * *',
      limit: 2,
      xsl: true,
      autoGenerate: false,
      caching: true,
      allowedFields: ['id', 'uid'],
      excludedTypes: [],
    },
  },
---

System

STRAPI VERSION: v4.20.0
Community Edition
NODE VERSION: v20.11.0
"strapi-plugin-sitemap": "^3.0.8",

Additional context

NA

@MSACC
Copy link
Collaborator

MSACC commented Feb 13, 2024

Let me know if this helps you:

#83 (comment)

@101sam
Copy link
Author

101sam commented Feb 13, 2024

The beta version solves the port issue.

@101sam 101sam closed this as completed Feb 13, 2024
@boazpoolman
Copy link
Member

Hi @101sam

Which beta version are you currently using now?
This should all have been merged to the stable release by now.

@boazpoolman
Copy link
Member

Note this part from the readme to make sure the URLs in the index are correct:

It is required to set the url in the ./config/server.js file in your Strapi installation. That will be used to create the links to the different chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants