Our initial approach to deploying PresidentPedro.com involved utilizing GitHub Pages. We aimed to leverage its simplicity for hosting static websites. However, we soon encountered several challenges that required us to rethink our strategy.
We began with a single development
branch in our Git repository. This branch contained all our project files, including 11ty source files and the generated _site
folder. We quickly realized that this structure would present some issues.
On the positive side, we successfully configured our custom domain (presidentpedro.com) to work with GitHub Pages. This involved:
CNAME
file in the root of our repository with our custom domain.This confirmed that we could point our domain to GitHub Pages, which was a crucial first step.
We observed that GitHub Pages had specific expectations regarding the index.html
file. When we placed a simple index.html
file in the root of our repository, it was correctly served at presidentpedro.com. However, this revealed a key limitation: GitHub Pages expects to find a static `index.html` file in the root of the repository.
When we attempted to use our 11ty template file (index.njk
) as our index page (replacing the static `index.html`), we encountered a 404 error. This highlighted the fact that GitHub Pages doesn't directly process Nunjucks templates. It serves static files, and our 11ty build process generates these static files.
In parallel with our GitHub Pages attempts, we successfully set up our local development environment. We encountered no significant issues with Node.js or npm installation. This was a positive step, as it allowed us to work more efficiently locally.
The primary challenges we faced were related to GitHub Pages' limitations and our initial repository file structure:
index.html
file in the root.After several attempts to find a workaround that would satisfy GitHub Pages' requirements, we decided to take a different approach. We wanted to establish a project structure that:
We realized that relying on workarounds to accommodate GitHub Pages would ultimately lead to a more complex and less maintainable project. We wanted to create a project that we could confidently share with others, without overwhelming them with immediate, GitHub Pages-specific solutions.
This realization led us to the decision to restructure our repository and implement a proper build and deployment process. This involved adopting a multi-branch strategy and leveraging GitHub Actions to automate the build and deployment, which we will cover in the next document.