4 ms·
The solution to the one problem he mentions is straightforward, isn't it? Embed the data needed for initial page load in the initial HTML delivered by the serve
by jrochkind1 11y ago
The solution to the one problem he mentions is straightforward, isn't it? Embed the data needed for initial page load in the initial HTML delivered by the server. Perhaps as JSON in a <script> tag.
I'm not too familiar with the new front-end frameworks, do any of them support this seamlessly? If not, I'm surprised, it seems like a fairly straightforward thing to architect.
What dismays me more about the rise of the static front-end single-page-app, is it really means the death of the idea of the architecture of the web. It's going in the opposite direction from the 'semantic web' dream, as well as REST.
- teen 11y agoI do it this way with angular / express / server side templating. You render the title/ meta tags serverside for crawlers (fb, twitter, google), and drop your initial request payloads in a script tag. Everything else is clientside. It took me a long time to set this up and get it right though. However, it's fast as hell, and really quick to develop on.
- mst 11y agoWorking on the assumption that the crawlers will index the JSON in the script tag?
- jrochkind1 11y agoCrawlers indexing is a different problem, and not the one the OP was talking about -- the OP's problem is specifically speed of first page display, and even more specifically speed of first page display due to having to make AJAX requests for data to display the first page. But crawlers and "single-page" Javascript apps are another potential problem, sure, although not the one the OP discussed. But wanting actual HTML in the original non-JS delivery for crawlers is I guess why people have followed the 'universal JS' approach instead of what we're talking about here. Other comments in this post suggest that Google, at least, does fine with Javascript-generated pages these days. I have no idea myself.
- mst 11y agoI was replying to a comment that specifically mentioned crawlers: https://news.ycombinator.com/item?id=10325666 https://news.ycombinator.com/item?id=10325666
- teen 11y agoJust catching up on this reply- yes- google has no problem rendering the json into readable html. Just using server side rendering for meta / title tags is the way to go (at least for now)
- teen 11y agoyes- and Google does this just fine. The meta tags are more for fb, slack, twitter, etc.