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

Support for sites without a pathPrefix #20

Closed
umstek opened this issue Feb 11, 2018 · 2 comments
Closed

Support for sites without a pathPrefix #20

umstek opened this issue Feb 11, 2018 · 2 comments

Comments

@umstek
Copy link

umstek commented Feb 11, 2018

The boilerplate code doesn't allow an empty pathPrefix in data/siteConfig.js but allows a / which will be regarded as "" (empty) somewhere and, there are also some code which will convert "" (empty) pathPrefix to a /.
These incompatibilities lead to URLs like https://org.github.io//test-url (note the double slash) in SEO and social share links.

@Vagr9K Vagr9K closed this as completed in 3e5d799 Feb 18, 2018
@Songkeys
Copy link

Songkeys commented Jan 20, 2019

@Vagr9K
When run build, it throws

ValidationError: child "pathPrefix" fails because ["pathPrefix" is not allowed to be empty]

Could this validator be disabled? Apparently only changing the parser in SEO component is not a good idea. For example, somewhere else (in Disqus), it also uses urljoin to get the url which also leads to https://org.github.io//test-url.

@Vagr9K Vagr9K reopened this Jan 20, 2019
@Vagr9K Vagr9K mentioned this issue Jan 20, 2019
@Vagr9K
Copy link
Owner

Vagr9K commented Jan 20, 2019

Apparently url-join doesn't de-duplicate slashes (jfromaniello/url-join#42).

In any case, you can either use an empty string or / as a pathPrefix.
GatsbyJS validation will be handled automatically.

Some additional validations to prevent incorrectly generated URLs were added.

Thanks for the report!

@Vagr9K Vagr9K closed this as completed Jan 20, 2019
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