-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
GatsbyJS Dynamic Results Pages & Auth #1538
Comments
Hey! Gatsby definitely sounds like a good fit for what you're doing. Gatsby can create statically built pages as well as client-only paths. For static pages, you'll want to build a source plugin for your API https://www.gatsbyjs.org/docs/create-source-plugin/ and then create pages using that. For authenticated parts of the site, check out this example site https://github.com/gatsbyjs/gatsby/tree/master/examples/client-only-paths for how to add client only sections of your site. |
@KyleAMathews — Thanks so much for taking the time to reply... I'm definitely going to try this approach out (on a smaller project first), and update this thread in due course :) |
Just jumping in to say that it would be great indeed to have a way to use the graphql layer for dynamic fetching. For example, here, the list of events would be created on build like normal so we have the static version of the list, then also have a fetch on the client side after everything is loaded. So if the list has changed since the last build, it gets updated. Even better, the client-side query could be altered by the client for a specific search or depending on its geolocation or... |
I have a similar use case as @MarcCoet and @rorz. We are planning to build a consumer content-heavy website using WordPress as a CMS and the WordPress REST API, however, the existing content on the website will be updated daily and new content will be added daily every few minutes. Also, it looks like |
@cr101 you do need to build everytime there's a change but it's pretty quick, 20-60 seconds depending on how many pages and how complex your JavaScript gets. |
@MarcCoet there's not yet a way to do live queries against Gatsby's graphql schema but that'd be a great feature to add |
@KyleAMathews Thank you for clarifying that. Since we will have over 10k posts in WordPress the build will take several minutes which means users will not be able to use the website while the build is taking place. |
Builds aren't done by the same process serving the website. You build the site and once it's done you copy the new version of the site over. |
The content changes are always made on the live WordPress site which is hosted on the same server where the build of the front-end website occurs. |
@cr101 As of yet I haven't included About build time, we successfully obtained build time of the site under 7 sec. And yes, each update of the static site is preceeded by a rebuild. My idea is to rebuild the site every hour using a |
@sebastienfi Just so I understand this correctly.
Would this rebuild the entire site or just update the nodes for the newly updated content or create new nodes for newly added content and then update/create the respective static pages? The reason I'm asking is because we are using WordPress as a CMS with the use of the Pods Framework and we have over 10K custom posts in the database. We update the existing content and adding new content every several minutes every day. |
@cr101 I suggest building a prototype to see if Gatsby will meet your needs. Would love help making sure Gatsby scales to bigger sites like yours! |
@KyleAMathews Building a prototype is not a bad idea, however, I'd like to first understand if GatsbyJS is a good fit to my scenarios and constraints and equally important to know the drawbacks and whether these can be mitigated.
Will it be possible to implement the "search as you type" and the search results filters at runtime? User login page. Will it be possible to show the user's name in the site header after user logging in and remove it after logging out? And there is still the issue of having to rebuild the entire site every time the content is changed in the WordPress database. Some folks use WordPress as a blogging platform, however, lots of developers also use WordPress as a CMS which has a massive market share. |
@cr101 Everything about search should be ok. For the search, there is 2 scenarios : About the login and stuff, one could implement a OAuth 2 process happening on the client side in order to allow the login request to be run against the WP server. Then you'll have to create a user context, and send this to the requests you send to WP. I do use WP as a CMS too, but I do use Gatsby to display the site only. The editing happens on the WP Back-end or using Calypso with Jetpack enabled sites. |
@sebastienfi Have you used lunr for doing the search and filtering of the search results in the browser? |
@cr101 Would you please share any update on your findings? |
@rashidul0405 I didn't use GatsbyJS in the end. Sorry that I can't help you. |
@cr101 appreciate your reply. Thanks. |
Thanks for everyone that contributing to this discussion! Clearing out old issues so closing this now. |
Hi folks,
I've used GatsbyJS many times pre v1, and would love to use the new dynamic page creation for a event management project I'm working on.
This would require searching and querying (w/ GraphQL) an external API to produce a dynamic list of results (events)... like a search results page. We'd have to implement auth (which I know is kinda possible from here: #1100) and payment, also.
Perhaps I'm being too ambitious but there's so many good things about the framework that I don't want to write it off just yet.
Is this possible? I got excited by the GatsbyGram example, but now I'm starting to think you can only generate pages dynamically (that are cached and served statically), instead of actual dynamic pages based on user queries.
The text was updated successfully, but these errors were encountered: