Comments (9)
I'm facing the same problem than @brianbento. I'd love to have a way to fully disable that conditional check
from gatsby-plugin-static-site.
@wardpeet: this is also what I had to add to make it fully work: in gatsby-browser
exports.onClientEntry = () => {
window.page = window.page || {};
window.page.path = window.location.pathname;
}
Should this be added somehow to the plugin?
from gatsby-plugin-static-site.
Let me have a look next week as I'm currently in New York with the gatsby team
from gatsby-plugin-static-site.
@xavivars I'm actually having the path being updated before onClientEntry fires. By the time the code has loaded it path has already been changes to the one that gatsby expects.
The proposed fix actually causes the pathname to be duplicated.
https://example.com/foo becomes https://example.com/foo/foo
Also
https://example.com/foo/bar becomes https://example.com/foo/foo/bar
from gatsby-plugin-static-site.
I'm actually using it without a path now, but with an assetPrefix, and that works. Didn't try with path, but I guess you should be removing basepath from this so it doesn't get added twice window.page.path = window.location.pathname;
from gatsby-plugin-static-site.
I could fix this when adding assetPrefix: '/foo'
to your gatsby-config.js
more info:
https://www.gatsbyjs.org/docs/asset-prefix/
This way your html files can live at / but your assets will live in /foo
from gatsby-plugin-static-site.
Maybe overriding match
from "@reach/router/lib/utils"
to always match could be a way to disable the the canonical redirect check... (but match is used also in the gatsby serve
command, not sure if this plugin only affects build and not develop
from gatsby-plugin-static-site.
overriding utils wouldn't fix page-data requests.
I have a PR up that should fix this.
A demo: (page 5 has a canonical redirect)
https://static-asset-prefix--zen-wright-33c2d8.netlify.com
from gatsby-plugin-static-site.
I've published a new minor @wardpeet/gatsby-plugin-static-site 0.1.0
. Please note that the minimum gatsby version is 2.11.1.
I'll be closing this issue, please reopen if it hasn't been resolved.
from gatsby-plugin-static-site.
Related Issues (16)
- Router override is not bundled by webpack HOT 9
- Page data is trying to be loaded from the path prefix HOT 43
- TypeError: Cannot read property 'page' of undefined when using gatsby develop HOT 11
- Question: Multiple pages mapping to same url HOT 1
- It doesn't work with gatsby build --prefix-paths HOT 4
- Request for features HOT 1
- Error when running gatsby develop HOT 2
- N/A HOT 1
- Breaks site in IE11 HOT 8
- How can disable this plugin except one page? HOT 4
- Action Required: Fix Renovate Configuration
- Plugin not compatible with gatsby V3 HOT 9
- Dependency Dashboard
- Not compatible with new gatsby version HOT 3
- It's not working with latest Gatsby version 4.0.0 and above HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-plugin-static-site.