<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:webfeeds="http://webfeeds.org/rss/1.0">
    
    <id>https://andretorgal.com/tags/content-management/atom.xml</id>
    <title>André Torgal: #content-management Feed</title>
    <subtitle>All updates tagged with #content-management</subtitle>
    <link href="https://andretorgal.com/tags/content-management/atom.xml" rel="self"/>
    <link href="https://andretorgal.com"/>

    <webfeeds:cover image="https://andretorgal.com/media/og-default.jpg" />
    <webfeeds:icon>https://andretorgal.com/assets/logos/logo-192.png</webfeeds:icon>
    <webfeeds:logo>https://andretorgal.com/assets/logos/logo.svg</webfeeds:logo>
    <webfeeds:accentColor>#a81715</webfeeds:accentColor>
    <webfeeds:related layout="card" target="browser"/>

    <author>
        <name>André Torgal</name>
        <email>hello@andretorgal.com</email>
        <uri>https://andretorgal.com</uri>
    </author>
    <updated>2023-01-26T00:00:00Z</updated>
    
    
    <entry>
        <id>https://andretorgal.com/posts/2023-01/mdx-authoring-experience-in-astro-shortcomings-and-astro-m2dx#2023-01-26</id>
        <title>MDX authoring experience in Astro / Shortcomings</title>
        <link href="https://andretorgal.com/posts/2023-01/mdx-authoring-experience-in-astro-shortcomings-and-astro-m2dx?source=rss"/>
        <updated>2023-01-26T00:00:00Z</updated>
        
        <summary type="html">Since I am migrating this site to Astro - which I am convinced is the best SSG out there right now - I was expecting to have the same advanced MDX authoring experience as in my previous website. Better even, maybe the challenges I was not able to solve before were meanwhile solved by the awesome folks out there. But I know well, there will be 🐉 🐉 🐉 dragons!</summary>

        <content type="html">
&lt;img src="https://andretorgal.com/_astro/dragons.DWvrrQkd.jpg" alt="Screenshot of the google image search results for &amp;#x22;dragons&amp;#x22;; 15 thumbnails of colourful artwork are shown"&gt;
&lt;p&gt;Since I am migrating this site to Astro - which I am convinced is the best SSG out there right now - I was expecting to have the same &lt;a href="https://andretorgal.com/posts/2023-01/saying-goodbye-to-my-react-static-website"&gt;advanced MDX authoring experience&lt;/a&gt; as in my previous website. Better even, maybe the challenges I was not able to solve before were meanwhile solved by the awesome folks out there.&lt;/p&gt;
&lt;p&gt;But I know well, there will be 🐉 🐉 🐉 dragons!&lt;/p&gt;
&lt;h2&gt;⚠️ You are looking at an outdated post.&lt;/h2&gt;
&lt;p&gt;I meanwhile upgraded Astro from 1.9 to 5. Some of the limitations are gone. You can now store images anywhere you like, including side by side with the content 🥳.&lt;/p&gt;
&lt;p&gt;As I wrote before, I have a &lt;a href="https://andretorgal.com/posts/2023-01/mdx-authoring-experience-in-astro-shortcomings-and-astro-m2dx"&gt;long list of requirements for the experience&lt;/a&gt; I want to have when authoring and managing content on my website.&lt;/p&gt;
&lt;p&gt;Most of these features were working quite well in the &lt;a href="https://andretorgal.com/posts/2023-01/saying-goodbye-to-my-react-static-website"&gt;previous version of this website&lt;/a&gt;. And they weren't that hard to accomplish! I rolled my own &lt;a href="https://andretorgal.com/posts/2023-01/unified-js-is-going-to-be-around-for-a-long-time"&gt;remark, rehype pipeline&lt;/a&gt;, so I was free to make any choices I pleased about where the files should live, &lt;a href="https://mdxjs.com/guides/frontmatter/"&gt;frontmatter&lt;/a&gt; manipulations, image optimisations, the works.&lt;/p&gt;
&lt;h2&gt;Computer says no&lt;/h2&gt;
&lt;p&gt;Unfortunately, Astro built-in features are not that flexible. 😓 On the contrary, they are &lt;a href="https://github.com/withastro/roadmap/pull/373"&gt;by design very opinionated&lt;/a&gt; about some things.&lt;/p&gt;
&lt;p&gt;Relevant to my interests is the strong preference of &lt;a href="https://docs.astro.build/en/guides/integrations-guide/image/"&gt;@astrojs/image&lt;/a&gt; to have all media stored in the &lt;code&gt;public/&lt;/code&gt; folder. And the pages? Well those, go in &lt;code&gt;src/pages&lt;/code&gt; 😢.&lt;/p&gt;
&lt;p&gt;Like 5 of my requirements became a bit more difficult in one go... Oh my! this is going to be a wild ride through a few rabbit 🐰 🕳️ holes.&lt;/p&gt;
&lt;p&gt;Can't believe I actually contemplated using ugly &lt;code&gt;../../public/...&lt;/code&gt; paths for a bit. Then I tried writing a simple remark plugin. Nah, things started breaking 😱 ... Whatever I tried, I was either breaking the &lt;code&gt;dev&lt;/code&gt; server or the static build.&lt;/p&gt;
&lt;p&gt;What about &lt;a href="https://docs.astro.build/en/guides/content-collections/"&gt;Astro collections&lt;/a&gt;? It would allow me to cleanup the frontmatter and not repeat &lt;code&gt;layout: ...&lt;/code&gt; everywhere. But could I have two items of different collections in the same folder? Oh noooooo! 😲 Astro's MD/X features are again "file system first":&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;A content collection is any directory inside the reserved &lt;code&gt;src/content&lt;/code&gt; ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After tinkering with all possible configuration options, searching in &lt;a href="https://github.com/search?q=%22%40astrojs%2Fmdx%22&amp;#x26;type=code"&gt;hundreds of Astro built websites&lt;/a&gt;, and reading through some disappointing &lt;a href="https://github.com/withastro/astro/issues/5008"&gt;conversations in Github issues&lt;/a&gt; ... 😫 ... I decided to use less built-in features and search for community plugins instead.&lt;/p&gt;
&lt;h2&gt;Third-party package: &lt;code&gt;astro-m2dx&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Honestly, Astro's community is big and growing, but the only thing out there that stood out was the &lt;a href="https://astro-m2dx.netlify.app/"&gt;astro-m2dx project&lt;/a&gt; which immediately resonated, a lot, with what I was looking for:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;• Define default frontmatter properties for all files in a directory, e.g. the layout&lt;/p&gt;
  &lt;p&gt;• Map HTML elements to JSX components on a per-directory basis&lt;/p&gt;
  &lt;p&gt;• Auto-import known JSX components on a per-directory basis&lt;/p&gt;
  &lt;p&gt;• Scan the document for Title or Abstract&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Unfortunately, the image implementation depends on using &lt;code&gt;import&lt;/code&gt; - as suggested by the &lt;a href="https://docs.astro.build/en/guides/integrations-guide/image/#images-in-public"&gt;Astros's documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But if the reference to the image is no longer a string with a resolvable &lt;code&gt;path/to/image.jpg&lt;/code&gt; then I can't reuse it easily - or can't use it at all - in other places such as the &lt;code&gt;og:image&lt;/code&gt; tag, or in good old thumbnails in lists.&lt;/p&gt;
&lt;p&gt;I still considered dealing with that later, and focus on the other &lt;code&gt;astro-m2dx&lt;/code&gt; features. But the first time I deployed it, the &lt;em&gt;auto imports&lt;/em&gt; feature was simply not working.&lt;/p&gt;
&lt;p&gt;In conclusion, &lt;code&gt;astro-m2dx&lt;/code&gt; has some really cool features, some very smart tricks inside, and depends on some super useful utils published independently as the &lt;a href="https://www.npmjs.com/package/m2dx-utils"&gt;m2dx-utils&lt;/a&gt; package.&lt;/p&gt;
&lt;p&gt;But the author is focused on other (much more important) things right now, and won't be able to help me with the &lt;a href="https://github.com/christian-hackyourshack/npm/issues/65"&gt;really strange and opaque ❌ CI issue&lt;/a&gt; that I ran into.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Time to take this into my own hands ✊ and have a go at putting together an "integration", using bits and pieces from all the things I saw in the last 2 weeks, and deliver that &lt;a href="https://andretorgal.com/posts/2023-01/improving-mdx-experience-in-astro-with-relative-paths-responsive-images-and-more"&gt;superior MDX authoring experience with Astro&lt;/a&gt;.&lt;/p&gt;
</content>
        <category term="ssg" />
        <category term="content-management" />
        <category term="andretorgal-com" />
    </entry>
    <entry>
        <id>https://andretorgal.com/posts/2023-01/advanced-mdx-authoring-experience-requirements#2023-01-25</id>
        <title>Advanced MDX authoring experience / Requirements</title>
        <link href="https://andretorgal.com/posts/2023-01/advanced-mdx-authoring-experience-requirements?source=rss"/>
        <updated>2023-01-25T00:00:00Z</updated>
        
        <summary type="html">Once I got my new website’s information architecture up and running, and migrated most of the old content, I want to make the authoring experience as awesome as possible. 🤩 At least as good as it was on my previous sites.</summary>

        <content type="html">
&lt;p&gt;Once I got my new website's &lt;a href="https://andretorgal.com/meta/docs/information-architecture"&gt;information architecture&lt;/a&gt; up and running, and migrated most of the old content, I want to make the authoring experience as awesome as possible. 🤩 At least as good as it was on my previous sites.&lt;/p&gt;
&lt;h2&gt;Backstory&lt;/h2&gt;
&lt;p&gt;I don't publish that much on the web these days. Not compared to the old times. But I have a long story, and a quite personal relationship, with content management.&lt;/p&gt;
&lt;p&gt;Between early 2000s and 2008 I had &lt;a href="https://andretorgal.com/meta/project/archaeology#around-2000"&gt;a "tireless", and experimental presence on the web&lt;/a&gt;, some times running on my own code, some times running on things like Wordpress. some times a combination of both.&lt;/p&gt;
&lt;p&gt;During my career so far, I also created from scratch several bespoke CMSs. And in the past few years, I am using &lt;a href="https://andretorgal.com/tags/mdx"&gt;MDX&lt;/a&gt; daily, building documentation for component libraries and design systems.&lt;/p&gt;
&lt;p&gt;
  So, when it comes to &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;migrating my site to a new framework&lt;/a&gt;,
  and looking at what features are available out of the box - and which ones I will have to rollout myself - I have a huge shopping list, a big appetite to invest, and I am going all in.
&lt;/p&gt;
&lt;h2&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Seamless preview as I type.&lt;/li&gt;
  &lt;li&gt;Along with auto-complete for links and images.&lt;/li&gt;
  &lt;li&gt;Sensible defaults for page metadata.&lt;/li&gt;
  &lt;li&gt;Extract &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;og:image&lt;/code&gt;, and more from the content.&lt;/li&gt;
  &lt;li&gt;Decorate external links.&lt;/li&gt;
  &lt;li&gt;Automatically import "react" components referenced in the &lt;code&gt;MDX&lt;/code&gt; content.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For images alone, I will settle with nothing short of:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Optimise images for responsive sizes.&lt;/li&gt;
  &lt;li&gt;Using both modern and fallback formats.&lt;/li&gt;
  &lt;li&gt;Semantic &lt;code&gt;&amp;#x3C;figure&gt;&amp;#x3C;picture&gt;&amp;#x3C;img&gt;&amp;#x3C;figcaption&gt;&lt;/code&gt; pattern.&lt;/li&gt;
  &lt;li&gt;With easy way to show a caption and an attribution link.&lt;/li&gt;
  &lt;li&gt;Generate as little as possible in &lt;code&gt;dev&lt;/code&gt; mode to speed up preview experience.&lt;/li&gt;
  &lt;li&gt;And &lt;a href="https://web.dev/optimize-cls/"&gt;minimised CLS&lt;/a&gt; by reserving vertical space for all images.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;Here's a more detailed look at some of these items, why they are so important to me, and how they combine to provide an awesome 🤩 experience.&lt;/p&gt;
&lt;h3&gt;Seamless preview&lt;/h3&gt;
&lt;p&gt;Number one item: keeping the markdown source code as &lt;em&gt;natural&lt;/em&gt; as possible.&lt;/p&gt;
&lt;p&gt;I want to type all the links as absolute paths from the root of the site &lt;code&gt;/posts/1998-03/post.mdx&lt;/code&gt;, including the &lt;code&gt;.mdx&lt;/code&gt; extension and allow VSCode to navigate from link to link on the MDX preview just as it does with your good old &lt;code&gt;README.md&lt;/code&gt; 😉.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/media-preview.DeeqfS4G.png" alt="Screenshot of VSCode with two split panes. On the left I am editing this page and on the right the MDX preview"&gt;
&lt;/p&gt;
&lt;p&gt;Also, keeping the image tags relative to the file that I am editing allows VSCode to just preview them as I type. And yes! 👇 I want the images right next to this file.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/co-located-images.C4usPV-A.png" alt="Screenshot of VSCode showing the code for this image side by side with the folder where all the screenshots used in the post are stored"&gt;
&lt;/p&gt;
&lt;h3&gt;Auto complete&lt;/h3&gt;
&lt;p&gt;The above strategy for links and images also provides the &lt;strong&gt;indispensable&lt;/strong&gt; auto complete. When I am typing links or image paths in MDX files, I just want it to drop down and help me out!&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/auto-complete-images.CEA0c5Dc.png" alt="Screenshot of VSCode showing this line of markdown code and VSCode suggesting the possible names for this image"&gt;
&lt;/p&gt;
&lt;p&gt;The same goes for links.&lt;/p&gt;
&lt;p&gt;Most pages of this website exist in the filesystem, so it would be a shame to mess with VSCode's ability to auto-complete as I type.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/auto-complete-links.BTMvI-lz.png" alt="Screenshot of VSCode showing a line of markdown code and VSCode suggesting auto-completions for a link to another page"&gt;
&lt;/p&gt;
&lt;h3&gt;Image optimisations&lt;/h3&gt;
&lt;p&gt;
  I want my &lt;a href="https://andretorgal.com/tags/ssg"&gt;SSG&lt;/a&gt; to
  detect all images and extract, beyond the &lt;code&gt;alt&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt;, also an attribution text and a link.
&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-md"&gt;![alt](./file.jpg 'Title // Attribution http://source...')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/waterfall-in-forest.C2nnp3MM.jpg" alt="Up close photo of a small waterfall in a very green and natural scenario" title="Thought you might need something fresh now // Photo by Ray Bilcliff on Pexels https://www.pexels.com/photo/waterfall-in-forest-waterfall-in-forest-5037136/"&gt;
&lt;/p&gt;
&lt;p&gt;I also want it to render responsive images, with different resolutions for different screen sizes. And generate modern &lt;code&gt;avif&lt;/code&gt; files as well as a legacy fallback formats. If you're curious, I wrote about &lt;a href="https://andretorgal.com/meta/docs/responsive-images#image-formats"&gt;why avif instead of webp&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-html"&gt;&amp;#x3C;picture&gt;
  &amp;#x3C;source
    type="image/avif"
    srcset="image-700px.avif 700w, image-1400px.avif 1400w"
    sizes="(max-width: 650px) 86vw, (max-width: 1200px) 650px, 1400px"
  /&gt;
  &amp;#x3C;img src="image-700.avif" alt="Photo of ..." loading="lazy" decoding="async" /&gt;
&amp;#x3C;/picture&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, I want &lt;code&gt;dev&lt;/code&gt; mode to use as little resources as possible to speed up the dev experience. It should only generate images for the page I am previewing, generating on demand whatever is requested by the browser, and should use something like &lt;code&gt;50%&lt;/code&gt; quality &lt;code&gt;jpg&lt;/code&gt; only.&lt;/p&gt;
&lt;p&gt;On the other hand, in static build time, it should optimise for production, using settings for better quality, and generate all the formats for all the files.&lt;/p&gt;
&lt;h3&gt;Auto detection of metadata&lt;/h3&gt;
&lt;p&gt;This is a no-brainer. I don't want to type things in frontmatter if they can be authored in - and then extracted from - the document.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-md"&gt;---
title: Improving the (MDX) authoring experience in Astro
description: 'Once I got .... dragons'
ogImage: ./_media/dragons.jpg
published: 2023 Jan 26
---
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I want to have the full markdown experience. I want my "abstract" to have links, italics, and emojis 🍺 damn it! And I want to render it wherever I want in this page, on another page that lists posts. And I want it to be markdown everywhere. Again: links, italics, emojis.&lt;/p&gt;
&lt;p&gt;But at the same time I also want to render &lt;code&gt;&amp;#x3C;meta name="description"&gt;&lt;/code&gt; and &lt;code&gt;og:description&lt;/code&gt; tags. Of course, in this case, I want to strip out all the funny stuff from the original content.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-mdx"&gt;&amp;#x3C;Abstract&gt;

Once I got my new website's [information architecture](/meta/docs/information-architecture) up and
running, and migrated most of the old content, I wanted to make the authoring experience as
awesome as possible. :star-struck: But I should know ... There might be dragons :dragon: :dragon:
:dragon:

&amp;#x3C;/Abstract&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, &lt;code&gt;og:image&lt;/code&gt; should default to the first image, unless specified otherwise in the metadata. And the &lt;code&gt;&amp;#x3C;h1&gt;H1 Title&amp;#x3C;/h1&gt;&lt;/code&gt;, also rendered as &lt;code&gt;og:title&lt;/code&gt; and &lt;code&gt;&amp;#x3C;title&gt;title&amp;#x3C;/title&gt;&lt;/code&gt; should, by this logic, be the&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-md"&gt;# Title
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are 2 principles at work here:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;DRY: don't repeat yourself!&lt;/li&gt;
  &lt;li&gt;The document is the source of truth, the metadata just just be a crutch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/auto-type-auto-layout-and-auto-title.B9oc7TA3.png" alt="&amp;#x22;Screenshot of two versions of the same file. On the left, there is no frontmatter, because title and abstract are inferred from the content."&gt;
&lt;/p&gt;
&lt;h3&gt;Frontmatter defaults per type of content&lt;/h3&gt;
&lt;p&gt;It's a pain to have to type in all my blog posts that they are &lt;code&gt;type: post&lt;/code&gt; or that they use &lt;code&gt;layout: ~/templates/BlogPost.astro&lt;/code&gt;. 🤢 Lame, time waster, error prone.&lt;/p&gt;
&lt;p&gt;I want all blog posts to be &lt;code&gt;type:post&lt;/code&gt; and tags to be &lt;code&gt;type:tag&lt;/code&gt; (maybe more in the future 😉) and I want the generator to provide defaults for the repetitive stuff.&lt;/p&gt;
&lt;h3&gt;External links&lt;/h3&gt;
&lt;p&gt;Show an &lt;a href="https://en.wikipedia.org/wiki/Arrow"&gt;arrow&lt;/a&gt; 👈 decoration on external links must to help users know if they're leaving my site... Oh no! don't leave! Come back!&lt;/p&gt;
&lt;p&gt;Also, all external links must carry the &lt;code&gt;rel="noopener"&lt;/code&gt; attribute &lt;a href="https://linkilo.co/rel-noopener/"&gt;for security and performance reasons&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Auto-imports&lt;/h3&gt;
&lt;p&gt;I also don't want to have to import components that I use often in my pages. I want to be focused on the content and have &lt;code&gt;&amp;#x3C;Hero&gt;&lt;/code&gt;, &lt;code&gt;&amp;#x3C;Abstract&gt;&lt;/code&gt;, &lt;code&gt;&amp;#x3C;Video&gt;&lt;/code&gt;, that type of stuff, always in scope.&lt;/p&gt;
&lt;h2&gt;Why stop here?&lt;/h2&gt;
&lt;p&gt;The moment I have all of these features working, I will want more for sure!!! I will want VSCode to preview my 🍺 and auto complete my emojis as well... 🥺 pretty please?&lt;/p&gt;
&lt;p&gt;I might have to dig into VSCode extensions as well.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/auto-complete-emojis.BzTXxjDy.png" alt="&amp;#x22;Screenshot of VSCode suggestion arbitrary words to auto-complete my emoji&amp;#x22;" title="Not helpful"&gt;
&lt;/p&gt;
&lt;p&gt;There's also plenty of content related challenges in &lt;a href="https://andretorgal.com/meta/project/backlog"&gt;my website's backlog&lt;/a&gt; such as a link roll worthy of the 20s. We're in the future, I want to embrace it. 🚀&lt;/p&gt;
&lt;h2&gt;Meanwhile&lt;/h2&gt;
&lt;p&gt;I still have to make all of the above happen first. Out of the box, Astro provides none of it.&lt;/p&gt;
&lt;p&gt;This narrative continues with &lt;a href="https://andretorgal.com/posts/2023-01/mdx-authoring-experience-in-astro-shortcomings-and-astro-m2dx"&gt;a look at Astro's built-in features and their opinionated patterns and limitations&lt;/a&gt;, along with an evaluation of the existing community driven projects.&lt;/p&gt;
&lt;p&gt;Will I be able to build it?&lt;/p&gt;
&lt;p&gt;🥁 🥁 🥁&lt;/p&gt;
</content>
        <category term="ssg" />
        <category term="content-management" />
        <category term="andretorgal-com" />
    </entry>
    <entry>
        <id>https://andretorgal.com/meta/docs/information-architecture#2023-01-20</id>
        <title>My website: Information architecture</title>
        <link href="https://andretorgal.com/meta/docs/information-architecture?source=rss"/>
        <updated>2023-01-20T00:00:00Z</updated>
        
        <content type="html">
&lt;p&gt;abstract&lt;/p&gt;
</content>
        <category term="andretorgal-com" />
        <category term="content-management" />
    </entry>
    <entry>
        <id>https://andretorgal.com/posts/2023-01/unified-js-is-going-to-be-around-for-a-long-time#2023-01-14</id>
        <title>Unified.js is going to be around for a long time</title>
        <link href="https://andretorgal.com/posts/2023-01/unified-js-is-going-to-be-around-for-a-long-time?source=rss"/>
        <updated>2023-01-14T00:00:00Z</updated>
        
        <summary type="html">This library is now powering ESLint, prettier, this website, … and pretty much anything using MD(X). Which is a lot and is only going to grow in the future. I say: it’s here to stay! ✊ And coming for your fridge.</summary>

        <content type="html">
&lt;img src="https://andretorgal.com/_astro/baking-tools.C08U2-6o.jpg" alt="Hero image of the article is a photo of baking tools. Silly metaphor, I know!"&gt;
&lt;p&gt;This library is now powering &lt;a href="https://eslint.org/"&gt;ESLint&lt;/a&gt;, &lt;a href="https://prettier.io/"&gt;prettier&lt;/a&gt;, this website, ... and pretty much anything using MD(X). Which is a lot and is only going to grow in the future. I say: it's here to stay! ✊ And coming for your fridge.&lt;/p&gt;
&lt;h2&gt;Context&lt;/h2&gt;
&lt;p&gt;I stumbled upon this project some 4 years ago. I believe because &lt;a href="https://storybook.js.org/"&gt;Storybook&lt;/a&gt;, then &lt;a href="https://www.gatsbyjs.com/"&gt;Gatsby&lt;/a&gt; were already using it.&lt;/p&gt;
&lt;h2&gt;What is it?&lt;/h2&gt;
&lt;p&gt;From their beautiful site:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;We compile content to syntax trees and syntax trees to content.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;An example of this is reading a &lt;a href="https://andretorgal.com/tags/markdown"&gt;Markdown&lt;/a&gt; file into a JS variable that you can modify and then output as HTML.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;We also provide hundreds of packages to work on the trees in between.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes, hundreds of little transformations, such as &lt;a href="https://unifiedjs.com/explore/package/rehype-external-links/"&gt;add &lt;code&gt;target&lt;/code&gt; and &lt;code&gt;rel&lt;/code&gt; attributes to all external links&lt;/a&gt;, or more complex ones, such as &lt;a href="https://unifiedjs.com/explore/package/remark-toc/"&gt;generate a table of contents.&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can use them analyse the content, for instance for linting purposes. Strip content, re-arrange, re-format it.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;You can build on the unified collective to make all kinds of interesting things.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;How do you use it?&lt;/h2&gt;
&lt;p&gt;You create a &lt;em&gt;pipeline&lt;/em&gt;, by composing a series of simple functions, and you can then you can use it to parse, transform, and render as many inputs as you want.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;markdownToHtml()&lt;/code&gt; function, accepts a markdown string and renders it to HTML.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-js"&gt;import html from 'rehype-stringify';
import markdown from 'remark-parse';
import remark2rehype from 'remark-rehype';
import unified from 'unified';

cosnt processor = unified()
  .use(markdown)
  .use(remark2rehype)
  .use(html);

async function markdownToHtml(input) {
  return process.processString(input).toString();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that the &lt;code&gt;async&lt;/code&gt; function. The pipelines are asynchronous and always return a promise.&lt;/p&gt;
&lt;h2&gt;An example using community plugins&lt;/h2&gt;
&lt;p&gt;Since this website is &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;built with Astro&lt;/a&gt;, and because Astro uses the Unified.js ecosystem for all things Markdown and MDX, I added &lt;code&gt;remark-emoji&lt;/code&gt; to the &lt;a href="https://github.com/andrezero/andretorgal-site/blob/main/astro.config.mjs"&gt;configuration&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And the build now replaces &lt;code&gt;:muscle:&lt;/code&gt; by 💪!&lt;/p&gt;
&lt;p&gt;Or even better, by adding &lt;code&gt;remark-a11y-emoji&lt;/code&gt;, it replaces &lt;code&gt;:muscle:&lt;/code&gt; by&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;#x3C;span role="img" aria-label="flexed biceps"&gt;💪&amp;#x3C;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To plug these two transformations to the above example, all you have to do is:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-js"&gt;import a11yEmoji from '@fec/remark-a11y-emoji';
import emoji from 'remark-emoji';

cosnt processor = remark() // &amp;#x3C;-- you can also start with remark
  .use(remarkEmoji) // &amp;#x3C;-- transform :beer: to emoji
  .use(remarkA11yEmoji) // &amp;#x3C;--  transform to `&amp;#x3C;span...&gt;`
  .use(remark2rehype)
  .use(html);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;The kudos 💯&lt;/h2&gt;
&lt;p&gt;The clever functional design, the rigor in principles, and patterns. 🤩&lt;/p&gt;
&lt;p&gt;You could tell, even 4 years ago, that this was going to be around for a while.&lt;/p&gt;
&lt;p&gt;Not only that, the super professional management of the project(s) and community, has been allowing it to grow this fast and conquer such an important space in the industry.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/unified-js-website.D0lrWymn.png" alt="Screenshot of the unified website with the headline Content as structured data" title="The unified-js-website is gorgeous"&gt;
&lt;/p&gt;
&lt;p&gt;I also have the feeling that this project, that claims to be ...&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;a collective&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;... has a certain human substance, strong ethical vibes, a certain ❤️ &lt;em&gt;I am not really sure&lt;/em&gt;, but you know what I mean.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;The unified collective is a federated system of organizations, consisting in turn of projects, governed by the team members steering them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Titus&lt;/h2&gt;
&lt;p&gt;The biggest kudos to &lt;a href="https://wooorm.com/"&gt;Titus&lt;/a&gt; who I believe is &lt;em&gt;the&lt;/em&gt; origin of all this.&lt;/p&gt;
&lt;p&gt;Their website now reads:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;I work most-time on open source maintaining 550+ projects that are downloaded 22B+ times a year.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Are you mind blown 🤯, yet?&lt;/p&gt;
&lt;p&gt;At the moment, Prettier, ESLint, MDX, and probably millions of websites and services out there - arguably ALL modern documentation websites - contain some Unified.js code.&lt;/p&gt;
&lt;h2&gt;How I use Unified.js&lt;/h2&gt;
&lt;p&gt;Before discovering &lt;a href="https://github.com/unifiedjs/unified"&gt;Unified.js&lt;/a&gt; I used many libraries to parse (and generate) Markdown documents. I remember &lt;code&gt;marked&lt;/code&gt; but in an &lt;a href="https://andretorgal.com/meta/project/archaeology"&gt;even older version of this website&lt;/a&gt; I found &lt;a href="https://github.com/evilstreak/markdown-js"&gt;markdown-js&lt;/a&gt; (now 13 years old 😂 and unmaintained).&lt;/p&gt;
&lt;p&gt;Since discovering the Unified.js ecosystem of highly pluggable micro libraries, I never used anything else. I reach for it all the time now, especially at work, usually to patch up deficiencies in tools such as &lt;a href="https://webpack.js.org/"&gt;Webpack&lt;/a&gt; or &lt;a href="https://rollupjs.org/"&gt;Rollup.js&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Fix builds, automate boring tasks, lint code, prevent errors, ...&lt;/p&gt;
&lt;p&gt;Quite a 🔨 tool to carry in your tool belt.&lt;/p&gt;
&lt;h2&gt;Show me some code!&lt;/h2&gt;
&lt;p&gt;Sure! I used it extensively to build this website. So you'll find some examples of manipulation in &lt;a href="https://github.com/andrezero/andretorgal-site/tree/main/src/integration"&gt;this part of the repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I created the &lt;code&gt;remark/&lt;/code&gt; plugins to manipulate the &lt;code&gt;markdown&lt;/code&gt; tree:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;autoAbstract()&lt;/code&gt; extracts &lt;code&gt;abstract&lt;/code&gt; from the document and stores in a metadata object.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;autoImages()&lt;/code&gt; replace image relative paths with absolute ones and.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;customComponents()&lt;/code&gt; makes sure that instead of rendering &lt;code&gt;&amp;#x3C;img&gt;&lt;/code&gt; tags we render a custom component.&lt;/li&gt;
  &lt;li&gt;and &lt;code&gt;autoImports()&lt;/code&gt; injects &lt;code&gt;import&lt;/code&gt; statements in the MDX context so that I don't have to manually import commonly used components.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;rehype/&lt;/code&gt; plugins manipulate the &lt;code&gt;HTML&lt;/code&gt;, also in &lt;a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree"&gt;abstract tree&lt;/a&gt; format, just before it is rendered. I only needed one - &lt;code&gt;externalLinks()&lt;/code&gt; - to add &lt;code&gt;rel="noopener"&lt;/code&gt; to all the external links.&lt;/p&gt;
&lt;p&gt;If you wanna follow the narrative, check out &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;the origin story&lt;/a&gt; or jump straight to my efforts to provide an &lt;a href="https://andretorgal.com/posts/2023-01/improving-mdx-experience-in-astro-with-relative-paths-responsive-images-and-more"&gt;advanced MDX authoring experience with Astro&lt;/a&gt;.&lt;/p&gt;
</content>
        <category term="content-management" />
    </entry>
    <entry>
        <id>https://andretorgal.com/posts/2023-01/saying-goodbye-to-my-react-static-website#2023-01-12</id>
        <title>Saying goodbye to my React Static website</title>
        <link href="https://andretorgal.com/posts/2023-01/saying-goodbye-to-my-react-static-website?source=rss"/>
        <updated>2023-01-12T00:00:00Z</updated>
        
        <summary type="html">I am relaunching my website with Astro. Writing down a word or two about the previous version, React Static, and the original “MDX” experience.</summary>

        <content type="html">
&lt;p&gt;I am relaunching my website with Astro. Writing down a word or two about the previous version, React Static, and the original "MDX" experience.&lt;/p&gt;
&lt;h2&gt;Backstory&lt;/h2&gt;
&lt;p&gt;My previous version of this website, back from 2019, was built with a &lt;a href="https://andretorgal.com/tags/ssg"&gt;static site generator (SSG)&lt;/a&gt;. This was the first requirement for me in 2019 when selecting the language and framework to bring my site back to life.&lt;/p&gt;
&lt;p&gt;React Static is now in maintenance mode and I need to replace it with something more modern.&lt;/p&gt;
&lt;p&gt;Maybe you want to skip ahead, and read about how I am &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;building it again with Astro&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Or stay, and walk with me as I revisit the &lt;a href="https://andretorgal.com/meta/records"&gt;decisions records&lt;/a&gt; of 2019, and ask:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;what still stands?&lt;/li&gt;
  &lt;li&gt;what goes away?&lt;/li&gt;
  &lt;li&gt;what else is needed?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;SSG! Of course&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://andretorgal.com/posts/2019-06/static-site-generators-brief-history"&gt;SSG has been around since the early days&lt;/a&gt; and I believe it's the best tool for many types of websites, definitely for &lt;em&gt;content first&lt;/em&gt; use cases, such as search engine optimised content, media distribution, documentation, personal websites, ... many more.&lt;/p&gt;
&lt;p&gt;👍 I was obviously going to stick to &lt;a href="https://andretorgal.com/tags/ssg"&gt;SSG&lt;/a&gt; in 2019 and there is no reason to change this now.&lt;/p&gt;
&lt;h2&gt;React Static was good, at the time&lt;/h2&gt;
&lt;p&gt;Even if I entertained the idea, and played around with some classics like &lt;a href="https://gohugo.io/"&gt;Hugo&lt;/a&gt; and &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt;, Typescript will always be &lt;em&gt;home&lt;/em&gt; to me. And a personal website should feel like home.&lt;/p&gt;
&lt;p&gt;Between the modern options, &lt;a href="https://andretorgal.com/meta/records/rejected/react-static"&gt;React Static&lt;/a&gt; seemed to be &lt;em&gt;one of the simple ones&lt;/em&gt;, inline with &lt;a href="https://www.11ty.dev/"&gt;Eleventy&lt;/a&gt;, and as opposed to Gatsby, an eventual serious contender, that I found about to be &lt;a href="https://andretorgal.com/meta/records/rejected/gatsby"&gt;a bit too complicated and rigid&lt;/a&gt; for my liking.&lt;/p&gt;
&lt;p&gt;On the other hand, React Static was less opinionated about how content should be structured, modeled, stored, loaded, or represented. And while it was simpler, it still allowed me to customise pretty much everything I ever thought of tweaking. For instance, I was able to rollout a custom &lt;em&gt;frontmatter&lt;/em&gt; approach with custom rules and defaults, according to my ideal information architecture.&lt;/p&gt;
&lt;p&gt;Nevertheless. The project went down. A shame especially because it seems to have been &lt;a href="https://github.com/react-static/react-static/discussions/1661"&gt;a victim of disruption by covid&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;🚫 React Static. I am now using &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;Astro + preact to rebuild my website&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Markdown love&lt;/h2&gt;
&lt;p&gt;I had been entertaining the idea of basing my website out of simple text files for a &lt;em&gt;looooong&lt;/em&gt; time. Maybe because I've been a fan of plain text since the early days of &lt;a href="https://www.mediawiki.org/wiki/Manual:Wiki_on_a_stick"&gt;wiki on a stick&lt;/a&gt;. It actually hits me now that I might have originally ported my website to &lt;a href="https://andretorgal.com/tags/markdown"&gt;Markdown&lt;/a&gt; back in 2016? Maybe? 😁&lt;/p&gt;
&lt;p&gt;Conclusion? Still the best support for documentation and personal publishing, and probably for many other use cases.&lt;/p&gt;
&lt;p&gt;Personally, my favorite medium to think and express myself, directly in the IDE in plain text. No database, no API, no CMS. Everything stored in Github &lt;a href="https://github.com/andrezero/andretorgal-site/tree/main/src/pages"&gt;right next to the code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;👍 No brainer. Did not change 4 year later.&lt;/p&gt;
&lt;h2&gt;Going the distance with MD(X) or...&lt;/h2&gt;
&lt;p&gt;Since I am some times craving for some exciting half-broken experience, at the time I also decided to use &lt;a href="https://andretorgal.com/tags/mdx"&gt;MDX&lt;/a&gt;, another content format, a mutation of &lt;a href="https://andretorgal.com/tags/markdown"&gt;Markdown&lt;/a&gt; if you will, that allows you to also drop React components in the middle of plain text.&lt;/p&gt;
&lt;p&gt;But since at the time, literally around &lt;code&gt;mdx@1.0&lt;/code&gt;, there were some serious limitation, I took the opportunity to explore how the whole thing works, and tried my hand at wiring up some transformations myself, using some of the code of the Markdown/MDX ecosystem.&lt;/p&gt;
&lt;h3&gt;Turned out to be a really fun experience!&lt;/h3&gt;
&lt;p&gt;Ended up using &lt;em&gt;a few&lt;/em&gt; libraries from the &lt;a href="https://andretorgal.com/tags/unified-js"&gt;unified-js&lt;/a&gt; ecosystem. Actually, looking at the direct dependencies on my &lt;code&gt;package.json&lt;/code&gt;, looks like I was able to put to good use a bunch of these beautiful micro packages.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rehype-autolink-headings
rehype-highlight
rehype-parse
rehype-raw
rehype-react
rehype-slug
remark
remark-emoji
remark-html
remark-parse
remark-rehype
remark-strip-html
remark-toc
remark-unlink
unified
unist-util-filter
unist-util-visit
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Did you read that :-D ?&lt;/p&gt;
&lt;p&gt;🤯 4 years later, &lt;a href="https://andretorgal.com/posts/2023-01/unified-js-is-going-to-be-around-for-a-long-time.md"&gt;MDX and unified-js ecosystem have come a long way&lt;/a&gt;. No more wiring up things manually. I am migrating the website to Astro, which already provides a great MDX integration, anyways.&lt;/p&gt;
&lt;h2&gt;Operations, performance, costs&lt;/h2&gt;
&lt;p&gt;The build time with React Static never went over 1 minute. No complains, ever.&lt;/p&gt;
&lt;p&gt;I never actually automated this in the cloud, and it was always running in my computer.&lt;/p&gt;
&lt;p&gt;💡 Speaking of which. I might &lt;a href="https://andretorgal.com/meta/records/pending/hosting-netlify-or-s3"&gt;change hosting from AWS to Netlify&lt;/a&gt;. This site has been hosted on S3/Cloudfront for almost 4 years, at around $2.50/month, but the Netlify is so much better than the AWS monster.&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;p&gt;Continue reading about &lt;a href="https://andretorgal.com/posts/2023-01/building-my-website-with-astro-mdx-preact"&gt;how I am rebuilding the website with Astro&lt;/a&gt;.&lt;/p&gt;
</content>
        <category term="ssg" />
        <category term="content-management" />
        <category term="andretorgal-com" />
    </entry>
    <entry>
        <id>https://andretorgal.com/posts/2019-06/static-site-generators-brief-history#2019-06-02</id>
        <title>Static site generators: brief history, as I recall it</title>
        <link href="https://andretorgal.com/posts/2019-06/static-site-generators-brief-history?source=rss"/>
        <updated>2019-06-02T00:00:00Z</updated>
        
        <summary type="html">Hype keeps building up around static site generators. But this technique has been around for much longer than most people think. Our industry’s collective memory 🧠 is very short, and it some times needs a little help.</summary>

        <content type="html">
&lt;p&gt;Hype keeps building up around static site generators. But this technique has been around for much longer than most people think. Our industry's collective memory 🧠 is very short, and it some times needs a little help.&lt;/p&gt;
&lt;p&gt;In the beginning the whole web was &lt;a href="http://info.cern.ch/"&gt;static&lt;/a&gt;. Then there was &lt;a href="https://en.wikipedia.org/wiki/Common_Gateway_Interface"&gt;CGI&lt;/a&gt;. Webmasters could now stitch together some dynamic rendering, as well as respond to forms posted by users.&lt;/p&gt;
&lt;p&gt;In less than 3 years, CGI evolved into a panoply of &lt;a href="https://en.wikipedia.org/wiki/Scripting_language#Glue_languages"&gt;glue languages&lt;/a&gt; developed exclusively for this purpose - e.g.: ColdFusion, PHP, Ruby, ASP, JSP - or quickly adapted to it - e.g.: Perl, Python.&lt;/p&gt;
&lt;h2&gt;The golden age of MVC&lt;/h2&gt;
&lt;p&gt;With the rise of these scripting languages, application servers, and the free relational databases - free as in free beer! - &lt;a href="https://dev.to/sunnysingh/the-benefits-and-origins-of-server-side-rendering-4doh"&gt;dynamic server-side rendering&lt;/a&gt; went from being the next big thing to completely taking over the landscape, all in a couple of years.&lt;/p&gt;
&lt;p&gt;At some point, MVC was everywhere, and OO was the craft. And with them, a hundred frameworks written in ColdFusion, PHP, Ruby, Python, Java, and .Net. Soon enough, the scene matured into CMSs of all sizes and flavors. Here's an article from 2007 about the &lt;a href="https://royal.pingdom.com/a-history-of-the-dynamic-web/"&gt;history of the dynamic web&lt;/a&gt; for a bit of perspective, from deep within the bubble.&lt;/p&gt;
&lt;h2&gt;Actually, the dark age of MVC&lt;/h2&gt;
&lt;p&gt;When I joined &lt;a href="https://www.sapo.pt/"&gt;SAPO&lt;/a&gt; in 2008 I had totally jumped on the MVC framework bandwagon and I didn't really know better. A single code base, a &lt;em&gt;monolith application&lt;/em&gt; for several interfaces - public website, rss, atom, back office. We had reached peak design patterns, maximum reusability, and couldn't even sense the smell.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/hammer-by-leo-moko.CfmpVZiA.jpg" alt="Photo of a hand holding a hammer" title="The hammer &amp;#x26; nail quote comes later. // Photo by Leo Moko on Unsplash https://unsplash.com/photos/B4YHKz6lLrQ"&gt;
&lt;/p&gt;
&lt;p&gt;Unfortunately, yet not surprisingly, these &lt;em&gt;database driven websites&lt;/em&gt; were not scaling that well. Don't get me wrong, they were dealing with complexity pretty fine, consuming and producing a variety of services, plugged into offline distributed processes, brokers, full-on SOA, the works.&lt;/p&gt;
&lt;p&gt;Run-time, though, writes and reads were competing for stretched out DB servers, and in order to keep the latency at acceptable levels, and to serve the apps with decent availability the operational costs were spiking. Blinded by the automagical lights, we were categorizing all the challenges under &lt;em&gt;optimise this later&lt;/em&gt;. Caching partials and responses, abusing cache farms, replicating the DB, micro optimising code, ... Plenty of technical solutions evolving, but at what cost?&lt;/p&gt;
&lt;h2&gt;Rendering like rebels&lt;/h2&gt;
&lt;p&gt;Meanwhile, back to SAPO, the older crew there, thought differently.&lt;/p&gt;
&lt;p&gt;These were a bunch of very talented engineers, and a handful of legend level Perl and C developers, that had built a network of hundreds of large scale, &lt;em&gt;high traffic, high availability websites&lt;/em&gt;, among so many other things, like dozens of mobile apps and even &lt;a href="http://makerfairelisbon.com/en/2014/07/16/spacebits.html"&gt;sending tech to space&lt;/a&gt; just for fun.&lt;/p&gt;
&lt;p&gt;So how did they think differently from the predominant MVC doctrine? Quite simple. First: &lt;em&gt;pre-rendering all the static content&lt;/em&gt;, and serving pure html+css. Second: &lt;em&gt;a layer of client-side progressive enhancement&lt;/em&gt;, rendering the user aware content, such as comments, ratings, favorites, directly in the browser. Sounds familiar?&lt;/p&gt;
&lt;p&gt;Whenever an editor published something on their CMS, entire websites or sections, were re-generated. After all, these back offices had like 2 journalists and an intern doing most of the writes. While the actual websites had millions of users doing all the reads and, only occasionally, an interaction.&lt;/p&gt;
&lt;p&gt;What was going on here? How could a bunch of disconnected perl scripts be better, faster, and cheaper than the elegant, modular, extensible approach? Turns out pre-rendering, or pre-burning, "queimar" in Portuguese, &lt;em&gt;materializing the end user state&lt;/em&gt; as soon as the source data was updated, wasn't even news in 2008. If you read the first section above, it was the actual origin story of the dynamic web. It had already been around for 10 years.&lt;/p&gt;
&lt;h2&gt;The plot twist we deserved&lt;/h2&gt;
&lt;p&gt;Meanwhile, the web-standards movement was striking win after win. With Firefox and Chrome, the browser was becoming a viable application platform, and client-side rendering, beyond the initial AJAX hacks, was becoming a believable idea.&lt;/p&gt;
&lt;p&gt;Suddenly, the paradigm was shifting. Along came NodeJS, the NoSQL movement, and a &lt;em&gt;massive simplification of the application server&lt;/em&gt; approach. Ditch relational and transactional where you actually don't needed it. Embrace REST, eventual consistency, schemaless, streams, client-side rendering, and much more long awaited techniques. Looked like we now had more options and combining the best of both (all) worlds would be the sensible thing to do.&lt;/p&gt;
&lt;p&gt;But it is not surprising that the new bandwagon and its rising tide of followers was riding fast and furious as far away as possible from its starting point. The past is wrong and all prior art needs to be forgotten! Rewrite all the things! Let's now &lt;em&gt;over engineer all things front-end&lt;/em&gt; because we can!&lt;/p&gt;
&lt;p&gt;Fast forward to 2013: we now have ES6, javascript build tools, Webpack, the NPM ecosystem and a new framework war fueled by Google and Facebook. Suddenly every project must be built as a front-end rendered single page application. Every startup is now hiring the new breed: the &lt;em&gt;full stack developer&lt;/em&gt;, a.k.a. let's just use Javascript everywhere for everything. So, what's next? &lt;a href="https://www.rtorr.com/on-javascript-fatigue/"&gt;Javascript fatigue&lt;/a&gt;, &lt;a href="https://allenpike.com/2015/javascript-framework-fatigue"&gt;Javascript framework fatigue&lt;/a&gt;, and more &lt;a href="https://ericclemmons.com/blog/javascript-fatigue"&gt;Javascript fatigue&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The new problem to solve? &lt;a href="https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html"&gt;Overcoming javascript framework fatigue&lt;/a&gt;. How did this happen? Did we stop to consider the implications? Were we leveraging all the options? Combining the best of each technology to solve the different problems with the right tools?&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/hammer-and-egg-pixabay.Cev7opUE.jpg" alt="Stock photo of a hammer lightly touching a chicken egg" title="// Photo from Pixabay https://pixabay.com/photos/weakness-hammer-crush-egg-eggshell-314401/"&gt;
&lt;/p&gt;
&lt;p&gt;When everything you ~~have~~ WANT TO USE is a hammer, everything looks like a nail. Landing page? SPA! personal website? SPA! newspaper? SPA! e-commerce? SPA! dating app for lonely pets? SPA! SPA! SPA! &lt;em&gt;SPA! is the new hammer and it makes the most lovely sound&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;History repeats itself&lt;/h2&gt;
&lt;p&gt;Long story long, welcome to 2019. People are writing posts &lt;a href="https://medium.com/@baphemot/whats-server-side-rendering-and-do-i-need-it-cb42dc059b38"&gt;explaining SSG&lt;/a&gt; maybe ignoring that so much of the original web was built exactly that way. Somewhere else, someone is &lt;a href="https://davidwalsh.name/introduction-static-site-generators"&gt;making the case for static site generation&lt;/a&gt; every single day.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.gatsbyjs.org/"&gt;Gatsby&lt;/a&gt;, &lt;a href="https://github.com/react-static/react-static/"&gt;React Static&lt;/a&gt;, &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt; are all the rage. But to be fair to prior art, in the early 2010s, projects like &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; then &lt;a href="https://gohugo.io/"&gt;Hugo&lt;/a&gt; were already getting a lot of traction in some circles and paved the way for &lt;a href="https://www.staticgen.com/"&gt;so many SSG options we have now&lt;/a&gt;. They are unfortunately not written in everyone's love/hate scripting language, but in Ruby and Go, respectively.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organisation sites. Think of it like a file-based CMS, without all the complexity.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Circling back to the whole point of this post.&lt;/em&gt; If you do a quick search for "static site generation" pre 2000s you can find gems like this paper on &lt;a href="http://webml.deib.polimi.it/upload/ent5/1/CompSurvey.pdf"&gt;Tools and Approaches for Developing Data-Intensive Web Applications: a Survey&lt;/a&gt;, all the way back in 1998.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;An orthogonal architectural issue concerns the time of binding between the content of the information base and the application pages delivered to the client, which can be static when pages are computed at application definition time and are immutable during application usage; or dynamic, when pages are created just-in-time from fresh content.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Do we already know better than letting the bandwagon mentality shoot us again with the new silver bullet? Are we going to make everything static site generated like we did with SPAs? Probably not. But if we don't stop obsessing (and click-baiting) about whether or not SSG is &lt;em&gt;paradigm of the year&lt;/em&gt; we will do a lot of damage to projects, businesses, and users.&lt;/p&gt;
&lt;p&gt;We have to be a bit less excited about the present and contemplate prior art as well. Better decisions are taken when considering all the options. And the next next big thing will always be a smart mashup of a few old things.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;There has never been a more &lt;em&gt;exciting time to develop for the web&lt;/em&gt;. We have the codebase, the tools, and the infrastructure to design, develop, and deploy faster, better than ever. And also options: modern SPAs, dynamic SSR, isomorphic rendering, serverless architectures, and more recently (joking! 😅) SSG.&lt;/p&gt;
&lt;p&gt;
  &lt;img src="https://andretorgal.com/_astro/tools-by-cesar-carlevarino-aragon.wRc5_3qD.jpg" alt="Photo of hundreds of DYI tools neatly organised" title="// Photo by Leo Moko on Unsplash https://unsplash.com/photos/NL_DF0Klepc"&gt;
&lt;/p&gt;
&lt;p&gt;And it's never been easier to &lt;em&gt;mix and match all these ingredients&lt;/em&gt; in secure, reliable, and cost-effective ways. Technologically, the entire web landscape has changed 5 times over and we are being gifted with all this potential under open source licenses for our fun and profit.&lt;/p&gt;
&lt;p&gt;We all - developers, teams, companies - just need to take a step back some times, and appreciate the options. Learn a bit about the techniques we understand the least and remember that the best solutions are almost always the result of combining different tools.&lt;/p&gt;
</content>
        <category term="ssg" />
        <category term="content-management" />
    </entry>
    <entry>
        <id>https://andretorgal.com/meta/records/rejected/content-markdown-unified-remark-rehype#2019-05-16</id>
        <title>Content: Markdown with Unified.js + Remark + Rehype</title>
        <link href="https://andretorgal.com/meta/records/rejected/content-markdown-unified-remark-rehype?source=rss"/>
        <updated>2019-05-16T00:00:00Z</updated>
        
        <summary type="html">I have been using Markdown to store my websites content for a while. Actually, I have been using forever to organise my life, especially work. Can I keep using it now with React Static?</summary>

        <content type="html">
&lt;p&gt;I have been using Markdown to store my websites content for a while. Actually, I have been using forever to organise my life, especially work. Can I keep using it now with &lt;a href="https://andretorgal.com/meta/records/rejected/react-static"&gt;React Static&lt;/a&gt;?&lt;/p&gt;
&lt;h2&gt;Status ❌ Replaced&lt;/h2&gt;
&lt;p&gt;Replaced by &lt;a href="https://andretorgal.com/meta/records/current/build-with-astro"&gt;Astro&lt;/a&gt; which pre-packages &lt;a href="https://andretorgal.com/tags/markdown"&gt;Markdown&lt;/a&gt; and &lt;a href="https://andretorgal.com/tags/mdx"&gt;MDX&lt;/a&gt; capabilities.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: 4 years later I eventually wrote a blog post to celebrate &lt;a href="https://andretorgal.com/src/pages/posts/2023-01/unified-js-is-going-to-be-around-for-a-long-time.md"&gt;how big and relevant Unified.js has become&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Why&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;modular library, many plugins&lt;/li&gt;
  &lt;li&gt;transforms to React&lt;/li&gt;
  &lt;li&gt;works in both directions&lt;/li&gt;
  &lt;li&gt;complete &lt;a href="https://github.com/s-thom/website/blob/develop/src/components/MdRenderer/index.tsx"&gt;working implementation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Trade-offs&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;not written in typescript and no typings supplied for many plugins&lt;/li&gt;
  &lt;li&gt;incomplete/inconsistent docs&lt;/li&gt;
  &lt;li&gt;many repos, different authors&lt;/li&gt;
&lt;/ul&gt;
</content>
        <category term="content-management" />
    </entry>
</feed>