Open dmr opened 7 years ago
Are you talking about having PHP render the markup for the initial page, rather than having to load the page, and then immediately make an API request to fetch the content?
Foxhound is already passing the content to JS during the initial page load. The markup is rendered by JS, but that's near instantaneous.
My short answer is no, I don't plan to add server side rendering, the pre-loading that @iandunn mentioned was my compromise there — the theme doesn't have to wait for the API on the first page load, once the JS finishes loading, it should immediately render the content.
The approach I've seen for server side rendering in themes usually involves duplicating the components into PHP templates, but I didn't want to do that. I've seen automated approaches, where a node command generates PHP, for example, but it's still a cumbersome process. There are also approaches using a JS engine extension for PHP so that PHP understands JS — that's what 10up did with NodeifyWP — but again, I wanted something easy for a user to install, so requiring extra PHP extensions was out.
Yes, I was asking for initially rendering the markup with PHP.
Thank you for the pointer to the SEO-issue. I think this might partly solve my issue/question.
If I search for the Foxhound demo blog article, google shows nice results, so in general the content preloading seems to work.
But if I search for the first sentence of the support page, I don't find anything: https://www.google.de/search?q=I%E2%80%99ve+installed+Foxhound%2C+but+I+see+a+javascript+error+in+the+console+%E2%80%94+or+%E2%80%94+the+page+is+reloading+when+navigating+through+the+site&oq=I%E2%80%99ve+installed+Foxhound%2C+but+I+see+a+javascript+error+in+the+console+%E2%80%94+or+%E2%80%94+the+page+is+reloading+when+navigating+through+the+site&aqs=chrome..69i57.307j0j7&sourceid=chrome&ie=UTF-8#q=I%E2%80%99ve+installed+Foxhound,+but+I+see+a+javascript+error+in+the+console+site:themes.redradar.net&*
--> TL;DR I think if there was a sitemap.xml google your index the page better and that would improve SEO?
The sitemap is just my guess, maybe it's something else but I want to find the content of every page on google.
The future of WordPress theme development is pretty unclear at the moment that is't very difficult to decide which approach to take. @ryelle Which direction do you see WP theme development going into? Do you think that NodeifyWP's approach is future proof or is Foxhound the better option from a web developer's point of view?
Are there any plans to support server-side rendering with Foxhound?
I think this would greatly benefit the user experience on mobile and the general speed. Thank you for building Foxhound, I like the idea of using the WP-API.