search

Static or Not?

Apr 07, 2025 am 10:31 AM

Static or Not?

Static website generator? Why don't I use it? Kev Quirk's short comment: Kev uses WordPress:

Want to blog on your iPad? no problem. Want to write on your phone? That's OK. Written on machines that I don't use often? As long as you have a browser, there is no problem.

First of all, it is worth mentioning that using WordPress does not mean that you cannot use static website generators. WordPress has an API that makes it possible to call the API during the build process to build your website. That's what Gatsby does, it has a plugin that exports static websites, while projects like Frontity blur the lines.

But I agree with Kev's reason. For all his reasons, and countless others, running a WordPress website is a perfectly acceptable and often wise choice. I think it's about robustness and functional completeness. Need e-commerce capabilities? WordPress has it. Need a form? There are many excellent plugins. Need to enhance the functionality of CMS? You can control the content type and its content. Need authentication? This is the core function. Want an excellent editing experience? Gutenberg is awesome.

Time and again, I quickly and efficiently build what I want with WordPress, which makes me feel efficient and powerful. But I don't want to talk about WordPress in particular; the same applies to any "classic" CMS. Craft CMS has a GraphQL API natively. We just posted a post about the Drupal Jamstack webinar.

In a relatively new world of static websites, a small thing can end up turning into a long process of research and implementation, and it feels like you are the only person on earth doing it.

Having said that...

What do I think of the static website generator and the world of Jamstack? They are great .

I think there are many benefits to building a website this way. The separation of data and front-end is wise. Very safe. The developer experience is also great, and everything is great for deploying previews and Git-based. The startup speed is amazing (providing HTML services from CDN is a feat).

Just like a classic server-side CMS won't stop you from building static websites, using static websites won't stop you from doing dynamic things — even super advanced dynamic things. Josh Comeau has a great new article that goes into this in depth. He built a nifty little app that does a lot of work with React in his browser, but that doesn't mean he still can't serve most of the content statically. He calls it a "change in mindset" and refers to what you might think you need a database call, but do you really need it? Has the database call occurred and a static file been generated? If not, then part of the content can still be generated statically and the rest can be obtained dynamically.

I look forward to a world where we begin to truly see the best of both worlds. We generate as much content as possible, get as much content as we can through the API that we cannot generate statically, and do not sacrifice the best tools throughout the process.

When to choose a static website...

  • If you can, you should consider it because it is unparalleled in speed and safety.
  • If you are working on a Greenfield project.
  • If your project is built from and uses an accessible API, you can call the API during the build process and use it after the initial HTML is loaded.
  • If a static website generator looks great for what you are doing.
  • If the cost analysis shows it is cheaper.
  • If certain features (such as build previews) are very helpful for the workflow.

When to choose server-side software...

  • If you need the functionality of a classic CMS (such as WordPress), and the technical debt from there is too high.
  • If you have been deeply involved in a server-side rendering project (Ruby on Rails, Python, etc.) and have not encountered any existing problems.
  • If your team has the most expertise in the field.
  • If the cost analysis shows it is cheaper.
  • If there is no good static solution for what you want to build (such as forum software).
  • If you are in extreme situations, such as millions of URLs, and the static build time is too long.

The wrong reason to choose a static website...

  • You need to use a server. (Why? You can still call the API on the server at build time or runtime.)
  • You need authentication. (Why? Jamstack can perfectly implement authentication with JWT, etc.)
  • You haven't even considered the Jamstack approach.

The error reason for choosing server-side software...

  • You haven't even considered the Jamstack approach.
  • Because you think using comfortable/existing/classic/mature/supported well-supported tools will prevent you from building anything statically.
  • Questions like SEO. (If anything, static rendering should perform better. However, it is understandable if the shift to static means turning to client calls to get product data, etc.)

The above is the detailed content of Static or Not?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
This Isn't Supposed to Happen: Troubleshooting the ImpossibleThis Isn't Supposed to Happen: Troubleshooting the ImpossibleMay 15, 2025 am 10:32 AM

What it looks like to troubleshoot one of those impossible issues that turns out to be something totally else you never thought of.

@keyframes vs CSS Transitions: What is the difference?@keyframes vs CSS Transitions: What is the difference?May 14, 2025 am 12:01 AM

@keyframesandCSSTransitionsdifferincomplexity:@keyframesallowsfordetailedanimationsequences,whileCSSTransitionshandlesimplestatechanges.UseCSSTransitionsforhovereffectslikebuttoncolorchanges,and@keyframesforintricateanimationslikerotatingspinners.

Using Pages CMS for Static Site Content ManagementUsing Pages CMS for Static Site Content ManagementMay 13, 2025 am 09:24 AM

I know, I know: there are a ton of content management system options available, and while I've tested several, none have really been the one, y'know? Weird pricing models, difficult customization, some even end up becoming a whole &

The Ultimate Guide to Linking CSS Files in HTMLThe Ultimate Guide to Linking CSS Files in HTMLMay 13, 2025 am 12:02 AM

Linking CSS files to HTML can be achieved by using elements in part of HTML. 1) Use tags to link local CSS files. 2) Multiple CSS files can be implemented by adding multiple tags. 3) External CSS files use absolute URL links, such as. 4) Ensure the correct use of file paths and CSS file loading order, and optimize performance can use CSS preprocessor to merge files.

CSS Flexbox vs Grid: a comprehensive reviewCSS Flexbox vs Grid: a comprehensive reviewMay 12, 2025 am 12:01 AM

Choosing Flexbox or Grid depends on the layout requirements: 1) Flexbox is suitable for one-dimensional layouts, such as navigation bar; 2) Grid is suitable for two-dimensional layouts, such as magazine layouts. The two can be used in the project to improve the layout effect.

How to Include CSS Files: Methods and Best PracticesHow to Include CSS Files: Methods and Best PracticesMay 11, 2025 am 12:02 AM

The best way to include CSS files is to use tags to introduce external CSS files in the HTML part. 1. Use tags to introduce external CSS files, such as. 2. For small adjustments, inline CSS can be used, but should be used with caution. 3. Large projects can use CSS preprocessors such as Sass or Less to import other CSS files through @import. 4. For performance, CSS files should be merged and CDN should be used, and compressed using tools such as CSSNano.

Flexbox vs Grid: should I learn them both?Flexbox vs Grid: should I learn them both?May 10, 2025 am 12:01 AM

Yes,youshouldlearnbothFlexboxandGrid.1)Flexboxisidealforone-dimensional,flexiblelayoutslikenavigationmenus.2)Gridexcelsintwo-dimensional,complexdesignssuchasmagazinelayouts.3)Combiningbothenhanceslayoutflexibilityandresponsiveness,allowingforstructur

Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)May 09, 2025 am 09:57 AM

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Clair Obscur: Expedition 33 - How To Get Perfect Chroma Catalysts
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft