<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Pinglei Guo</title>
    <description>The latest articles on Forem by Pinglei Guo (@at15).</description>
    <link>https://forem.com/at15</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F313220%2F536ff481-934c-4424-9559-ed3f4eae4dac.png</url>
      <title>Forem: Pinglei Guo</title>
      <link>https://forem.com/at15</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/at15"/>
    <language>en</language>
    <item>
      <title>Why blog using Docusaurus and Cloudflare Pages</title>
      <dc:creator>Pinglei Guo</dc:creator>
      <pubDate>Fri, 12 Jan 2024 09:06:53 +0000</pubDate>
      <link>https://forem.com/at15/why-blog-using-docusaurus-and-cloudflare-pages-45jh</link>
      <guid>https://forem.com/at15/why-blog-using-docusaurus-and-cloudflare-pages-45jh</guid>
      <description>&lt;p&gt;Why I decided to setup a blog using Docusaurus and deploy to Cloudflare Pages instead of using gatsby, netlify, or&lt;br&gt;
github pages. NOTE: You can also find this post on the blog &lt;a href="https://at15.dev/blog/2023/12/why-blog-using-docusaurus-and-cloudflare-pages"&gt;https://at15.dev/blog/2023/12/why-blog-using-docusaurus-and-cloudflare-pages&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Why use static site generator for blog when you have Medium, Wordpress?
&lt;/h2&gt;

&lt;p&gt;I have used several hosted blog services such as &lt;a href="https://medium.com/@at15"&gt;Medium&lt;/a&gt;,&lt;br&gt;
WordPress, &lt;a href="https://ghost.org/"&gt;Ghost&lt;/a&gt;. These managed platforms do not require any setup&lt;br&gt;
and provide better exposure thanks to existing audiences on the platform.&lt;br&gt;
The main reason I choose to use static site generator is they allow me to write blog as code&lt;br&gt;
in plain markdown, version control the content using git and add style/interactive components (in React) when needed.&lt;br&gt;
The managed platforms offer many things out of box but their customization and API is&lt;br&gt;
limited e.g. &lt;a href="https://github.com/Medium/medium-api-docs"&gt;Medium API is no longer supported&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Docusaurus instead of Gatbsy, Hugo, Jekyll, etc?
&lt;/h2&gt;

&lt;p&gt;GitHub pages offers Jekyll and I am not a fan of Ruby (working at AWS on region build made the feeling even worse).&lt;br&gt;
Building Jekyll pages locally is much painful compared with Go or NodeJS based static site generator because I&lt;br&gt;
don't setup Ruby toolchain on my own devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gohugo.io/"&gt;Hugo&lt;/a&gt; is in Go but the template syntax and the extensibility is not as good as these React based&lt;br&gt;
ones such as Gatsby and Docusaurus.&lt;/p&gt;

&lt;p&gt;Gatsby is the one I planned to start with because it offers a GraphQL API, making building extension and interact with&lt;br&gt;
other languages a breeze. However, after looking at&lt;br&gt;
its &lt;a href="https://www.gatsbyjs.com/starters/gatsbyjs/gatsby-starter-blog/"&gt;blog template&lt;/a&gt;, I found there are several things&lt;br&gt;
I need to implement by myself such as &lt;a href="https://www.gatsbyjs.com/docs/adding-tags-and-categories-to-blog-posts/"&gt;tag&lt;/a&gt;.&lt;br&gt;
I am lazy and want most things out of box with a reasonable default that I customize later.&lt;/p&gt;

&lt;p&gt;Then I looked into documentation type of static site generator such as &lt;a href="https://docusaurus.io/"&gt;Docusaurus&lt;/a&gt;&lt;br&gt;
and &lt;a href="https://vuepress.vuejs.org/"&gt;VuePress&lt;/a&gt;. I have used VuePress&lt;br&gt;
for &lt;a href="https://github.com/xephonhq/awesome-time-series-database"&gt;awesome-time-series-database&lt;/a&gt;, but the VuePress blog&lt;br&gt;
plugin's last update time is &lt;a href="https://github.com/vuepress/vuepress-plugin-blog"&gt;9 months ago&lt;/a&gt; so I tried Docusaurus.&lt;br&gt;
The default docusaurus template support both doc and blog with tags, the blog looks better than gatsby's blog template.&lt;br&gt;
So I decided to use Docuasurus.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Cloudflare Pages instead of Netlify, GitHub Pages?
&lt;/h2&gt;

&lt;p&gt;GitHub Pages is the most straightforward to setup when source code of blog is hosted on GitHub and I used to use it&lt;br&gt;
before I switched to Netlify for &lt;a href="https://docs.netlify.com/site-deploys/deploy-previews/"&gt;PR preview&lt;/a&gt; which&lt;br&gt;
is &lt;a href="https://github.com/orgs/community/discussions/7730"&gt;not supported by GitHub Pages&lt;/a&gt;. However, Netlify's free plan has&lt;br&gt;
limit on &lt;a href="https://www.netlify.com/pricing/"&gt;100GB bandwidth&lt;/a&gt; and&lt;br&gt;
then &lt;a href="https://www.netlify.com/pricing/#core-pricing-table"&gt;$55 Per 100GB&lt;/a&gt;&lt;br&gt;
while &lt;a href="https://community.cloudflare.com/t/cloudflare-bandwidth-limit/447321"&gt;Cloudflare Pages has no limit on bandwidth&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cloudflare Pages does have its very&lt;br&gt;
special &lt;a href="https://developers.cloudflare.com/pages/platform/limits/#files"&gt;20,000 files&lt;/a&gt; hard limit due&lt;br&gt;
to &lt;a href="https://community.cloudflare.com/t/cloudflare-pages-what-plan-do-we-need-to-exceed-the-20k-asset-limit/408982/2"&gt;technical limit&lt;/a&gt;.&lt;br&gt;
But as long as I don't copy &lt;code&gt;node_modules&lt;/code&gt; into the &lt;code&gt;build&lt;/code&gt; directory, it might take years for me to hit that limit with&lt;br&gt;
notes and blogs (116 files right now). btw: You can count the files (including subdirectories)&lt;br&gt;
using &lt;code&gt;find . -type f | wc -l&lt;/code&gt;&lt;br&gt;
per &lt;a href="https://unix.stackexchange.com/questions/4105/how-do-i-count-all-the-files-recursively-through-directories"&gt;stackoverflow&lt;/a&gt;.&lt;br&gt;
If I did hit the limit, I could host (part of) the website on other places (e.g. nginx, object store like R2/S3)&lt;br&gt;
and use (Cloudflare) CDN to serve the content.&lt;/p&gt;

&lt;p&gt;In next post I will talk about the actual steps of creating the blog using Docusaurus and configure Cloudflare Pages&lt;br&gt;
with github integration and custom domain.&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>blog</category>
      <category>react</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
