[{"content":"In this post, I will share my experience of integrating Hugo with GitHub and Cloudflare to create a seamless workflow for deploying my static site.\nSetting Up Hugo First, I installed Hugo on my local machine and created a new site using the command:\nhugo new site my-hugo-site I then added a theme and created some content for my site. After customizing the site to my liking, I built the site using:\nhugo This generated the static files in the public directory, which I was ready to deploy.\nIntegrating with GitHub Next, I initialized a Git repository in my Hugo site directory and pushed the code to GitHub using the following commands:\ngit init git add . git commit -m \u0026#34;Initial commit\u0026#34; git remote add origin git push -u origin main Deploying with Cloudflare To deploy my site, I set up a Cloudflare Worker that fetches the static files from GitHub and serves them to visitors. I created a new Worker in the Cloudflare dashboard and added the following code:\naddEventListener(\u0026#39;fetch\u0026#39;, event =\u0026gt; { event.respondWith(handleRequest(event.request)) }) async function handleRequest(request) { const url = new URL(request.url) const response = await fetch(`https://raw.githubusercontent.com/username/repository/branch/path/to/public${url.pathname}`) return response } I replaced username, repository, branch, and path/to/public with the appropriate values for my GitHub repository. This Worker fetches the static files directly from GitHub and serves them to visitors.\nConclusion Integrating Hugo with GitHub and Cloudflare has been a great experience. It allows me to easily manage my content with Hugo, version control with GitHub, and deploy seamlessly with Cloudflare. This setup has significantly streamlined my workflow and made it easier to maintain my static site. I highly recommend this integration for anyone looking to create and deploy a static site efficiently.\n","permalink":"https://hicke.se/posts/2026-05-01-hugo-and-github-a-perfect-cloudflare-integration/","summary":"\u003cp\u003eIn this post, I will share my experience of integrating Hugo with GitHub and Cloudflare to create a seamless workflow for deploying my static site.\u003c/p\u003e\n\u003ch3 id=\"setting-up-hugo\"\u003eSetting Up Hugo\u003c/h3\u003e\n\u003cp\u003eFirst, I installed Hugo on my local machine and created a new site using the command:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ehugo new site my-hugo-site\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI then added a theme and created some content for my site. After customizing the site to my\nliking, I built the site using:\u003c/p\u003e","title":"Hugo and GitHub: A Perfect Cloudflare Integration"}]