Never tested Cloudflare pages so gave it a try. Easy and quick to set up. Liked the UI and the docs. Was thinking that I could make use of this on some projects.
But:
The build times are slow, nearly 3 minutes for a bare bones Hugo site.
They use really old versions of everything! Node 12, PHP 5, Python 2, Hugo 0.54 etc.
When you specify some less ancient versions the build time goes over 3 minutes.
GitHub actions build my sites in 20-40 seconds as a comparison.
That’s not possible with Cloudflare Pages yet. You have to do it per project. Also, look for Cloudflare’s Discord and request to be added to their fast builds which are in beta. The current builds are very long though due to the “initializing build environment”.
I am still not convinced “we all” don’t have an issue with caching a build environment here… of course all needs to be installed once, but then it should be re-used and if it’s installed again over and over again on rebuilds then it might be a wrong use of caching. (on our part, not Cloudflare’s). I’ll check it out in a bit with one of my sites, just to play around.
We’re just starting to test Cloudflare Pages but what it comes down to for now is:
Cloudflare has a “initialize build environment” step which is ran on every build (this is for us what takes to most times during the build, we’re talking minutes for very small projects)
The only settings available for your project are handled through the dashboard.
Settings let you define one build command which is shared by what they call “production” and “preview” environment.
Settings let you define environment variables, one set for “production” and another one for “preview”
Just like netlify, you can control versioning with environment variables (HUGO_VERSION, GO_VERSION, NODE_VERSION etc…)
Redirects and Headers can be handled exaclty like Netlify’s (_redirects, _headers) file built and using the same syntax and capabilities.
Redirect rules are limited to 100 per projects which can be constraining on some big multilingual/regionalized projects.
You can pause deployment, rollback to a given deploy, same as netlify
It has deploy hooks, just like Netlify
Of course it handles functions/workers but I have yet to test those. I’ve got a feeling the overall experience will be better than on Netlify.
By adding a Workers Script to the Service or deploying a Cloudflare Pages project, you are granting Cloudflare a limited, revocable, worldwide, non-exclusive, royalty-free, sub-licenseable right to use your Workers Script and/or code and assets from your project as is necessary to provide you the Service (“License”). You retain all copyright and any other proprietary rights that you may hold in your Workers Script(s) as well as the code and the assets from your project(s) that you provide (or derived from such code and assets through the build process) to Cloudflare.
Reading through the terms of use seems like if you use pages or workers you are basically giving them the right to copy paste your project and info in it. so if you do not have some sort of copyright its not your project any more.
Due to this i want to only give public folder to Cloudflare pages:
I might be out of date but I thought Netlify had more free build time (300 mins per month) but Cloudflare had unlimited bandwidth vs Netlify’s 100gbs per month.
Netlify has free forms (100 submissions per month). Though there a plenty of other similar free form services out there. Cloudflare has free web stats.
Netlify CMS, although free and open source, is very simple to set up on Netlify, esp authentication (I think there are even 1 click installs somewhere).
Cloudflare’s CDN is a bigger network.
I’ve only used Cloudflare for one site and I’ve not looked at build times but it does seem a little slower before the new build is available in the browser (but only by about a minute).
One issue I had on my Cloudflare site was {{ .Lastmod }} didn’t work and just produced the most recent date, though works fine locally. Not got to the bottom of that yet so it may or may not be to do with Cloudflare. But never had the same issue on the Netlify sites I’ve made.
Morally… well I prefer to support Netlify because they seem like the innovators of this kind of service and seem like the little guy now compared with Cloudflare who are just copying their ideas.
My guess is that the diff in build speed comes from Netlify’s persistent build cache (for images, mostly). For Netlify, Hugo will set it up automatically, but for Cloudflare you would need to do some config (or: Set the HUGO_CACHEDIR env var to something that gets passed along on the next build).
they really fast to feedback I suggested this day before yesterday and yesterday in 1 day they release this. I don’t think it was big thing for them to do but they are really quick to feedback which really made use it more than netlify.
Hugo can export website to custom folder so I set it up to push directly to connected server folder which push to GitHub which then push to cloud-flare. And I realise even when the site is pre-made cloud-flare still try to set environment which was useless. they also working on faster environment setup. last thing I will hope is a netlify like cms from cloudflare
We should not accept these build times as ‘normal’. Seriously. If your local machine builds in milliseconds, why can’t/wouldn’t your server? Are servers really that much slower than laptops/desktop computers? Clearly, the answer is ‘no’. I have DEPLOY times of less than a second on a 100+ page Hugo website.
Check out the logs of such a “build”. The Hugo runtime is as short as on your local machine. The time eaten is going to the creation of the build environment and deployment of files. And they say so in their documentation too.
Like others have mentioned, the bulk of job run-time in free cloud tiers is usually from non hugo things: pulling the base image, building it (installing other tooling), running it, etc.
I’m all for continuous improvement. But the tone of this thread has strayed a bit.
Let’s not forget how cool of times we live in: You can use an open-source tool to build your (many thousand) page site in under a second. Then use someone else’s computers to host your built site, which can handle thousands of page views for… free.