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

Update index.js #41

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Xentropics
Copy link

Prefixed the url with self.baseUrl in line 494, so the sitemap will be valid if baseUrl is configured in the module, but not at application level.

Prefixed the url with self.baseUrl in line 494, so the sitemap will be valid if baseUrl is configured in the module, but not at application level.
@abea
Copy link
Contributor

abea commented Oct 6, 2020

Is the idea with this change to allow a different domain for the sitemap from what is configured for the application? Why would you want to do that?

UPDATE: Nevermind! I see that's in the documentation already.

@abea abea self-requested a review October 6, 2020 19:00
@Xentropics
Copy link
Author

Slightly off-topic, but an answer to your question: we're using it for a website that switches languages based on subdomain, so we don't define baseUrl in app.js. Of course that in itself causes all kinds of trouble with the sitemap, SEO, Open Graph and so on. So I will probably look into the workflow module for one of the next releases.

@boutell
Copy link
Member

boutell commented Oct 8, 2020

Hmm. This would break the module for most people because self.baseUrl defaults to the apostrophe top-level baseUrl, which will already be present in url if it was set.

But, we went down the road of suggesting that this option is a viable alternative to setting the global baseUrl long ago. Even if the workflow module is a better answer really.

So it makes sense to fix it, but the logic has to check whether self.options.baseUrl is set before prepending self.baseUrl, so it doesn't get prepended twice.

@Xentropics
Copy link
Author

You're absolutely right. Happy to improve that.

Added check if baseUrl is set in app.js. If not, prefixing the url with self.baseUrl, but only if set...
@Xentropics
Copy link
Author

In the fix I'm proposing now, baseUrl in app.js always wins if set. Not sure if that is intended behaviour. The other way around would imply removing the baseUrl from the page url.

Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should do it.

@abea abea removed their request for review October 9, 2020 14:01
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

Successfully merging this pull request may close these issues.

3 participants