{
"path": "/posts/2025/migrating-to-astro/index",
"site": "at://did:plc:mracrip6qu3vw46nbewg44sm/site.standard.publication/self",
"$type": "site.standard.document",
"title": "Migrating To Astro",
"updatedAt": "2025-07-26T00:07:03.636Z",
"description": "A short, fast rollercoaster",
"publishedAt": "2025-07-26T00:07:03.636Z",
"textContent": "I've run Thought Eddies as a more dynamic, experimental blog since the beginning of this year.\nI'd heard about Astro and wanted to put a more personal touch on my web presence.\n\nI wrote an article here or there and then one day, after I'd run into a bit of a block working on Tomo, I had the itch to build Thought Eddies out.\n\nI have several post types I write frequently, so I needed to build sections for those.\nThen I added support for a bunch of the shortcodes I'd built over the years in Hugo as well as URL aliases.\nI _try_ to keep all my old links alive and redirecting properly.\n\nCombined with the strong ecosystem of Astro and LLMs, I was able to build and migrate nearly all the content within about a week.\n\nOne of the finishing touches was a search that I practically one-shotted with an agent, that was _exactly_ what I wanted.\n\n!Search modal\n\nI wanted to build something like the search page on my previous site, which loaded all the site content client-side and did a client-side search as well.\nIt wasn't efficient but it worked and didn't require a backend.\nI never had any problems with it and my site was building fast and loading fine.\n\nSo I added this search modal, triggered by <kbd>⌘</kbd>+<kbd>k</kbd> on any page, I finished migrating over my content, and I started building and deploying the site.\nAnd wow was it slow.\nAlmost three minutes on my local and almost 15 on CI.\n\nWhat?\n\nI started searching around and reading the Astro Discord, looking for reports of slow builds.\nMy site isn't big.\nThere aren't many images.\n\nSo I ran the build a bunch and started inspecting what was slow.\nOne major problem were the number of Open Graph images I was generating.\n\nI had a custom one per page.[^1]\n\nThat was not a great idea.\nEach took a few 100ms to build.\nI tried switching to a different library, started taking more than one second each.\n\nOk, no problem.\nOne Open Graph image per site section will be fine.\n\n_The build was still taking more than two minutes._\n\nAt several points over the course of a few days, I opened devtools and viewed the site's source.\nIt didn't fully load.\nWas Waterfox buggy?\nI didn't really know.\n\nI almost noticed the site was taking ~500ms to load.\n_Just_ slow enough to be annoying.\n\nHugo (the static site generator I used to build my previous site) is quite fast and there is much discussion about how the Javascript web (and Astro by proxy) can be slow and bloated, but was it really this bad?\nI had never run into performance like this before.\nI'd built an Electron app of far greater complexity and even that tooling seems nicer than was I was running into here.\n\nEventually, I realized I needed to actually see the HTML source for myself.\nThese were static HTML pages after all.\nTo build the site, a webserver starts and a process requests the content for each page, then persists it as a static HTML file to be served in production.\n\nWhat was taking so long?\n\nI pulled down a page of the site and started to look around\n\nI saw the page content, a bunch of CSS across the different components, some <path>s, and then I started to see my post content.\n\nNot for the page I was on but for all of the pages across the site.\n\nAnd then it dawned on me.\nMy seemingly innocuous, static search required all the content from across my site for the client-side search to work.\n\nEvery HTML page contained the full content of the entire site.\n\nClassic 🤦\n\nRemoving the search functionality from every page brought the site build time down to around 10 seconds total.\n_By no means_ fast or reasonable all you web purists will tell me because the web is HTML, CSS, and vanilla JavaScript and everything should be 10kb and load in milliseconds.\nBut totally workable for me to build a blog with and have a fine time.\n\n[^1]: I was pretty proud of this and thought the preview looked pretty good when sending site links in Slack or Messages",
"canonicalUrl": "https://www.danielcorin.com/posts/2025/migrating-to-astro/index"
}