From da0006411a200ee84deec41e58358963985d2f12 Mon Sep 17 00:00:00 2001 From: Glenn Thompson Date: Thu, 2 Jan 2025 14:12:51 +0300 Subject: [PATCH] feat: Add new blog post about static site generator journey and fix local development setup --- build.sh | 25 +- content/content | 1 + content/posts/2024-04-08-glove80-review.html | 147 +++++++ .../2024-05-01-amman-newcastle-journey.html | 140 +++++++ content/posts/2024-05-15-hugo-to-haunt.html | 362 ++++++++++++++++++ .../posts/2024-07-26-gnu-guix-journey.html | 190 +++++++++ content/posts/2024-09-24-scheme-journey.html | 188 +++++++++ .../posts/2024-12-03-practical-scheme.html | 268 +++++++++++++ .../2025-01-02-from-haunt-to-custom.html | 197 ++++++++++ .../posts/2025-01-02-from-haunt-to-custom.md | 93 +++++ content/posts/test-blog-post.md | 28 -- .../2025-01-02-from-haunt-to-custom.html | 197 ++++++++++ deploy/feed.xml | 85 +++- deploy/index.html | 157 ++++---- deploy/js/md-to-html.js | 146 ++++++- feed.xml | 85 +++- index.html | 157 ++++---- js/generate-rss.js | 111 ++++++ js/main.js | 25 ++ js/md-to-html.js | 342 +++++++++++++++++ package-lock.json | 294 ++++++++++++++ package.json | 4 +- src/js/md-to-html.js | 146 ++++++- website-deploy.zip | Bin 100921 -> 111284 bytes 24 files changed, 3192 insertions(+), 196 deletions(-) create mode 120000 content/content create mode 100644 content/posts/2024-04-08-glove80-review.html create mode 100644 content/posts/2024-05-01-amman-newcastle-journey.html create mode 100644 content/posts/2024-05-15-hugo-to-haunt.html create mode 100644 content/posts/2024-07-26-gnu-guix-journey.html create mode 100644 content/posts/2024-09-24-scheme-journey.html create mode 100644 content/posts/2024-12-03-practical-scheme.html create mode 100644 content/posts/2025-01-02-from-haunt-to-custom.html create mode 100644 content/posts/2025-01-02-from-haunt-to-custom.md delete mode 100644 content/posts/test-blog-post.md create mode 100644 deploy/content/posts/2025-01-02-from-haunt-to-custom.html create mode 100644 js/generate-rss.js create mode 100644 js/main.js create mode 100644 js/md-to-html.js diff --git a/build.sh b/build.sh index 09b95ed..25fd677 100755 --- a/build.sh +++ b/build.sh @@ -34,6 +34,7 @@ CONVERTED_COUNT=0 # Create deploy directory if it doesn't exist mkdir -p "$DEPLOY_DIR" +mkdir -p "$MD_DIR" # Ensure local directory exists too echo "Checking for new markdown files..." @@ -44,22 +45,29 @@ for md_file in "$MD_DIR"/*.md; do # Get the base name of the file base_name=$(basename "$md_file") - # Create the HTML filename in the deploy directory + # Create the HTML filenames html_file="$DEPLOY_DIR/${base_name%.md}.html" + local_html_file="$MD_DIR/${base_name%.md}.html" # Check if HTML file doesn't exist or markdown file is newer if [[ ! -f "$html_file" ]] || [[ "$md_file" -nt "$html_file" ]]; then - echo "Converting: $md_file to $html_file" + echo "Converting $base_name to HTML..." node src/js/md-to-html.js "$md_file" "$html_file" + # Also copy to local directory for development + cp "$html_file" "$local_html_file" ((CONVERTED_COUNT++)) fi done -if [ $CONVERTED_COUNT -eq 0 ]; then - echo "No new markdown files to convert." -else - echo "Converted $CONVERTED_COUNT file(s)." -fi +echo "Converted $CONVERTED_COUNT new or modified files" + +# Update summaries in index.html +echo "Updating blog post summaries in index.html..." +npm run update-summaries + +# Generate RSS feed +echo "Generating RSS feed..." +node src/js/generate-rss.js # Run the deploy script echo "Running deploy script..." @@ -71,6 +79,9 @@ if [ "$SERVE" = true ]; then echo "Visit http://localhost:$PORT to view your site" echo "Press Ctrl+C to stop the server" + # Copy deploy files to root for local development + cp -r deploy/* . + # Start live-server with specific options ./node_modules/.bin/live-server \ --port=$PORT \ diff --git a/content/content b/content/content new file mode 120000 index 0000000..abc9673 --- /dev/null +++ b/content/content @@ -0,0 +1 @@ +deploy/content \ No newline at end of file diff --git a/content/posts/2024-04-08-glove80-review.html b/content/posts/2024-04-08-glove80-review.html new file mode 100644 index 0000000..ce32592 --- /dev/null +++ b/content/posts/2024-04-08-glove80-review.html @@ -0,0 +1,147 @@ + + + + + + + + + + "Aesthetic Meets Ergonomics: My Deep Dive into the Glove80 Keyboard" - Glenn Thompson + + + + + + + + +
+
+
+
+

"Aesthetic Meets Ergonomics: My Deep Dive into the Glove80 Keyboard"

+
+ + + 5 min read + + By "Glenn Thompson" +
+ +
+ ["personal""tech""keyboards""glove80"] +
+
+ +
+

In the quest for the ultimate ergonomic keyboard, aesthetics often take a backseat to functionality. Yet, when I first laid eyes on the Glove80, I was struck by its elegant design—a refreshing departure from the utilitarian look typical of many ergonomic keyboards. Unlike the retro vibes of the Kinesis Advantage or the DIY aesthetics of most Dactyls, the Glove80 boasts a modern, sleek appearance that complements the contemporary design language of Apple, Google, and LG devices. With its clean lines and visually appealing legends, the Glove80 not only promises ergonomic comfort but does so with style, standing out amidst a sea of competitors.

+

As my career trajectory veered from being an integral member of an electrical engineering team to assuming the role of Deputy Project Manager, the nature of my daily activities underwent a significant transformation. The hands-on tasks of yesteryears were gradually replaced by a deluge of documentations—writing, reviewing, and endless typing. This shift brought with it an unwelcome companion: discomfort in my hands and wrists, a stark reminder of the ergonomic pitfalls of conventional keyboards. It was in this context that my quest for a more ergonomic typing solution began, leading me towards the world of ALICE layout keyboards, with the Q10 Pro by Keychron being my initial foray into this new realm.

+

However, the relief was partial, and the shadow of wrist strain persisted, urging me to delve deeper into the ergonomic keyboard universe. My search for a truly ergonomic solution brought me to the doorstep of the Glove80 by MoErgo. Boasting a unique split design, concave key wells, and a commitment to ergonomics that seemed almost tailor-made for my situation, the Glove80 held the promise of being the oasis I was desperately seeking in the desert of my wrist discomfort.

+

This journey from an ALICE layout keyboard user to a Glove80 enthusiast was not just about finding a better typing tool; it was about embracing a healthier typing posture and redefining my interaction with computers. After a month of integrating the Glove80 into my workflow, I'm ready to share my insights and experiences. This review will explore the initial adaptation period, the impact on my wrist health, and whether the Glove80 lives up to its promise as an ergonomic game-changer.

+

First Impressions: Feel and Experience

+

Upon beginning my typing journey with the Glove80, two aspects immediately stood out. The unique choc spacing, combined with finger-specific curves for each key column, facilitated effortless access to the bottom and number rows, as well as several function keys—without the need to move my hands. This ease of reach extended to the thumb keys, thoughtfully laid out in an arc to match the natural movement of my thumbs. Additionally, the keyboard's low profile on the desk encouraged a neutral wrist position, enhancing comfort during long typing sessions. These features converged to create a typing experience that was not just comfortable but intuitively aligned with natural hand movements.

+

The Details That Matter

+
Ergonomics at Its Core
+

The hallmark of the Glove80 is its ergonomics, designed to seamlessly integrate with the user's hand movements. After fine-tuning the tenting and tilting angles—made possible by the adjustable feet on each half of the keyboard—my hands naturally fell into the optimal typing position. The thoughtfully designed key layout meant that reaching for higher rows required merely straightening or curling my fingers, aided by the keyboard's choc spacing. Each column's unique height and curve catered to the different lengths of my fingers, further minimizing strain.

+
Key Innovations
+

The Glove80 introduces keycaps with a novel MCC profile, featuring raised sides and a central cylindrical channel, made from a slick POM material. This design supports the natural sliding of fingers across keys, reducing the need to lift hands while typing. The keyboard's thumb clusters are another highlight, offering six easily accessible keys per hand. This ergonomic layout ensures that most keys are within reach without stretching, a testament to the keyboard's user-centric design.

+
Beyond Typing: Features and Flexibility
+
    +
  • Tenting and Adjustability: The Glove80's customizable tenting angles, enhanced by sturdy locking nuts, ensure a tailored typing experience that can be finely adjusted to individual preferences.
  • +
  • Comfortable Palm Rest: The integrated, detachable palm rest offers additional comfort, catering to different typing styles with ease.
  • +
  • Switch Selection: While the standard Kailh choc switches are adequate, enthusiasts might prefer customizing their keyboard with preferred switches for an optimized typing feel. I opted for the lighter Kailh Choc V1, Red Pro Linear 35gf switches.
  • +
  • Keycaps: The high-quality POM keycaps, combined with attractive and durable legends, enhance the keyboard's tactile and visual appeal.
  • +
  • Tech-Savvy Features: From its easy-to-use firmware updates via a web interface to seamless Bluetooth connectivity and impressive battery life, the Glove80 is designed for a modern, wireless world.
  • +
  • RGB Lighting: While currently limited in customization, the RGB LEDs offer aesthetic versatility to match any setup.
  • +
+

Concluding Thoughts

+

The Glove80 keyboard represents a significant leap forward in ergonomic design, marrying aesthetics with unmatched comfort and functionality. Its thoughtful features—from the infinitely adjustable tenting to the innovative keycap design—set a new standard for what ergonomic keyboards can be. While there's room for improvement in switch selection and RGB customization, these are minor quibbles in an otherwise outstanding product. For those in search of ergonomic excellence without compromising on style or performance, the Glove80 is an investment worth making, promising a typing experience that's not just comfortable but truly enjoyable.

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2024-05-01-amman-newcastle-journey.html b/content/posts/2024-05-01-amman-newcastle-journey.html new file mode 100644 index 0000000..7353f61 --- /dev/null +++ b/content/posts/2024-05-01-amman-newcastle-journey.html @@ -0,0 +1,140 @@ + + + + + + + + + + A Rollercoaster Week: From Amman to Newcastle, and back again - Glenn Thompson + + + + + + + + +
+
+
+
+

A Rollercoaster Week: From Amman to Newcastle, and back again

+
+ + + 3 min read + + By Glenn Thompson +
+ +
+ worktravel +
+
+ +
+

Two weeks ago was a whirlwind of events, taking me from the conforting embrace of Amman, Jordan to the vibrant streets of Newcastle, England. It was a journey filled with highs and lows, professional achievements, and personal challenges.

+

The Journey Begins

+

It all started on a Monday morning in Amman as I embarked on a journey to attend a Quality Control (QC) conference in Newcastle. The anticipation of presenting my work at an international forum filled me with excitement and nerves. The conference was scheduled for just one day, but the impact it had on me would last much longer.

+

A Successful Presentation

+

Tuesday arrived, and with it came the day of the conference. Armed with a PowerPoint presentation comprising over 130 slides, I delved into four hours of intense presenting. Despite the pressure, the conference was a resounding success. My project received positive feedback, and I felt a sense of accomplishment as I shared my work with colleagues from around the world.

+

The Toll of Travel

+

However, as I returned to Amman on Wednesday, I couldn't shake off a sense of exhaustion. Little did I know that the toll of travel would soon manifest itself in a most unexpected manner.

+

Thursday morning greeted me with heavy flu-like symptoms. It hit me like a ton of bricks. The combination of jet lag, long hours of presenting, and exposure to new environments had taken its toll on my immune system. I was bedridden, grappling with a chesty cough that seemed relentless.

+

The Show Must Go On

+

Despite my illness, there was no time for rest. The following week demanded my presence at a site meeting where I was tasked with condensing my extensive slide deck into a concise presentation of just 12 slides. The challenge was daunting, but I tackled it with determination.

+

Reflecting on the Journey

+

As I look back on the rollercoaster week that was, I'm struck by the juxtaposition of success and struggle. From the heights of presenting at an international conference to the lows of battling illness, it was a journey that tested my resilience and resolve.

+

But through it all, one thing remains clear: adversity only serves to make us stronger. Each obstacle we overcome, whether professional or personal, contributes to our growth and development.

+

So here's to the rollercoaster weeks, the ones filled with ups and downs, twists and turns. For it is in those moments of challenge that we discover the true extent of our capabilities.

+

As I upload this blog post using Hugo, I do so with a renewed sense of gratitude for the journey and all it has taught me. Here's to embracing the ride, wherever it may take us.

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2024-05-15-hugo-to-haunt.html b/content/posts/2024-05-15-hugo-to-haunt.html new file mode 100644 index 0000000..e1080a1 --- /dev/null +++ b/content/posts/2024-05-15-hugo-to-haunt.html @@ -0,0 +1,362 @@ + + + + + + + + + + Transitioning from Hugo to Haunt: Embracing Scheme and GNU Guix - Glenn Thompson + + + + + + + + +
+
+
+
+

Transitioning from Hugo to Haunt: Embracing Scheme and GNU Guix

+
+ + + 7 min read + + By Glenn Thompson +
+ +
+ personaltechkeyboardsglove80 +
+
+ +
+

Transitioning from Hugo to Haunt: Embracing Scheme and GNU Guix

+

Hello there! I'm Glenn Thompson, and today, I want to share a significant part of my recent journey into the world of Scheme, GNU Guix, and static site generation.

+

Discovering Scheme with System Crafters

+

My journey began with a desire to dive deeper into programming languages and their ecosystems. I am a member of the System Crafters Community, and its founder, David Wilson, announced a short four week course as an introduction to Guile Scheme. The course, Hands-On Guile Scheme for Beginners, provided me with a robust introduction to Guile Scheme, a language that emphasizes simplicity and elegance. David's clear explanations and practical examples made learning Scheme both engaging and approachable.

+

The Move to GNU Guix

+

Inspired by the principles of Scheme, I decided to take a leap further into the open-source world by transitioning from Arch Linux to GNU Guix. The Guix community, particularly the folks in the #systemcrafters channel on irc.libera.chat, were incredibly supportive and instrumental in helping me navigate this new environment. Their guidance made the switch smooth and rewarding, reinforcing the power and flexibility of GNU Guix as a functional package manager and operating system. More about that experience in another post.

+

There are too many individuals to name here that have helped with the installation and configuration on Gnu guix to mention here. You all have been an incredible help for which I am extremely grateful. Thank you all , for enduring my ignorance, and for your patience and your help.

+

From Hugo to Haunt

+

As I settled into Guix, I faced a challenge: Hugo, the static site generator I previously used, was not available as a Guix package. This led me to explore alternatives and eventually discover Haunt, a Scheme-based static site generator that aligns perfectly with my newfound appreciation for Scheme and Guix.

+

Overcoming Challenges with Haunt

+

Transitioning to Haunt wasn't without its challenges. There are no readily available templating systems available for haunt like there are for hugo, but there are plenty of examples here. One of my own primary difficulties was creating a custom template that matched my site's aesthetic requirements and functionality needs. Initially, I struggled with configuring the theme layout and ensuring the CSS was applied correctly. Another hurdle was generating the correct URLs for posts and ensuring that summaries appeared as intended on the front page.

+

Thankfully, the Haunt manual proved to be an invaluable resource throughout this process. The comprehensive documentation provided clear guidance on using various modules, functions, and procedures. By carefully studying the examples and explanations, I was able to overcome the obstacles and achieve the desired results for my site. The manual's detailed descriptions of Haunt's inner workings were particularly helpful in understanding how to leverage the flexibility of Scheme to customize my blog.

+

Crafting My Own Template

+

Moving from Hugo to Haunt required me to create my own template and customize my site's appearance. This was an exciting opportunity to apply the skills I had learned from David's course and experiment with Scheme in a practical context.

+

Creating the Template

+

Haunt's flexibility allowed me to define my own theme layout and structure. Here's a snippet of my haunt.scm file, where I defined the theme layout and added custom footer content:

+
(use-modules (haunt asset)
+             (haunt builder blog)
+             (haunt builder atom)
+             (haunt builder assets)
+             (haunt reader commonmark)
+             (haunt site)
+             (haunt post)
+             (sxml simple)    ; For HTML generation
+             (srfi srfi-1)
+             (srfi srfi-19))  ; For date and time procedures
+
+;; Load custom templates
+(load "templates/post.scm")
+
+(define (format-date date)
+  (date->string date "~Y-~m-~d"))
+
+;; Define a function to generate the URL for a post
+(define (post-url post)
+  (string-append "/" (post-slug post) ".html"))
+
+;; Define a function to extract a summary from the post content
+(define (post-summary post)
+  (let ((content (post-sxml post)))
+    (if (null? content)
+        ""
+        (let ((first-paragraph (car content)))
+          (if (string? first-paragraph)
+              (substring first-paragraph 0 (min 200 (string-length first-paragraph)))
+              (sxml->string first-paragraph))))))
+
+;; Define the theme layout
+(define (theme-layout site title content)
+  (let ((current-year (number->string (date-year (current-date)))))
+    `(html
+      (head
+       (meta (@ (charset "utf-8")))
+       (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0, shrink-to-fit=no")))
+       (link (@ (rel "stylesheet") (href "/assets/palenight.css")))
+       (style
+        " .craftering {
+            margin: auto;
+            width: 50%;
+            text-align: center;
+        }
+        .webring-text {
+            text-align: center;
+            margin-bottom: 20px;
+            color: white;
+        }
+        .craftering a {
+            color: #dddddd;
+        }
+        .webring-text a {
+            color: #dddddd;
+        }")
+       (title ,title))
+      (body
+       (header (h1 ,(site-title site)))
+       (main ,content)
+       (footer (@ (class "bg-black bottom-0 w-100 pa3") (role "contentinfo"))
+               (div (@ (class "flex justify-between"))
+                    (div (@ (class "webring-text"))
+                         (p "I am part of the " (a (@ (href "https://systemcrafters.net") (target "_blank")) "System Crafters") " webring:"))
+                    (div (@ (class "craftering"))
+                         (a (@ (href "https://craftering.systemcrafters.net/@glenneth/previous")) "←")
+                         (a (@ (href "https://craftering.systemcrafters.net/")) "craftering")
+                         (a (@ (href "https://craftering.systemcrafters.net/@glenneth/next")) "→"))))))))
+
+;; Define the custom theme with a consistent layout for index
+(define my-theme
+  (theme #:name "My Custom Theme"
+         #:layout theme-layout
+         #:post-template post-template
+         #:collection-template
+         (lambda (site title posts prefix)
+           `(div (@ (class "content"))
+              (h2 ,title)
+              (ul
+                ,@(map (lambda (post)
+                         `(li
+                            (article
+                              (header
+                               (h3 (a (@ (href ,(post-url post))) ,(post-title post))))
+                              (p ,(format-date (post-date post)))
+                              (p ,(post-summary post))
+                              (p (a (@ (href ,(post-url post))) "Read more...")))))
+                       posts))))))
+
+;; Site configuration
+(site #:title "Just Another Personal Blog"
+      #:domain "glenneth.srht.site"
+      #:default-metadata
+      '((author . "Glenn Thompson")
+        (email  . "glenn@kirstol.org"))
+      #:readers (list commonmark-reader)
+      #:builders (list
+                  (blog #:theme my-theme)
+                  (atom-feed)
+                  (atom-feeds-by-tag)
+                  (static-directory "images")
+                  (static-directory "assets")))
+
+

Customizing the CSS

+

To give my site a personalized touch, I crafted a CSS stylesheet that matched my aesthetic preferences. Here’s an excerpt from my palenight.css file:

+
body {
+  display: flex;
+  justify-content: center;
+  padding: 10px;
+}
+
+.content, header, footer, main {
+  max-width: 90%;
+  padding: 0 5%;
+}
+
+header {
+  text-align: center;
+  margin-bottom: 20px;
+}
+
+footer {
+  text-align: center;
+  margin-top: 20px;
+}
+
+ul {
+  list-style-type: none;
+  padding: 0;
+}
+
+li {
+  margin-bottom: 20px;
+}
+
+a {
+  text-decoration: none;
+}
+
+a:hover {
+  text-decoration: underline;
+}
+
+body {
+  background-color: #292d3e;
+  color: #d0d0d0;
+}
+
+a {
+  color: #82aaff;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #c792ea;
+}
+
+.content {
+  background-color: #1e1e2e;
+  padding: 20px;
+  border-radius: 5px;
+}
+
+article {
+  background-color: #282a36;
+  padding: 15px;
+  border-radius: 8px;
+  margin-bottom: 20px;
+}
+
+article header {
+  margin-bottom: 10px;
+}
+
+.date {
+  color: #6272a4;
+  font-size: 0.9em;
+}
+
+/* Additional styles for the craftering */
+.craftering {
+  margin: auto;
+  width: 50%;
+  text-align: center;
+}
+
+.webring-text {
+  text-align: center;
+  margin-bottom: 20px;
+  color: white;
+}
+
+.craftering a {
+  color: #dddddd;
+}
+
+.webring-text a {
+  color: #dddddd;
+}
+
+/* Additions for mobile device readability */
+
+meta {
+  name: viewport;
+  content: width=device-width, initial-scale=1, shrink-to-fit=no;
+}
+
+@media screen and (max-width: 767px) {
+  /* Customize styles for smaller screens */
+  .logo {
+    max-width: 200px;
+  }
+
+}
+
+

I use the doom-palenight theme in Emacs, my preferred text editor, and I wanted my site to match that aesthetic.

+

Publishing with Haunt and Hut

+

In addition to using Haunt, I adopted hut, a set of command-line tools for interacting with SourceHut, to publish my blog. This streamlined my workflow, making it easier to manage and deploy my site directly from my local environment.

+

Conclusion

+

Transitioning from Hugo to Haunt, learning Scheme, and embracing GNU Guix has been an enriching experience. It's not just about using new tools; it's about joining a community that values simplicity, transparency, and collaboration. If you're curious about Scheme or GNU Guix, I highly recommend checking out David Wilson's course on System Crafters and joining the discussions on IRC.

+

I am not a developer of any kind, and learning Scheme has opened my eyes as to how I can craft an environment that I want to work in, and not endure a working environment that the computer is forcing upon me.

+

Thank you for reading, and stay tuned for more updates on my journey!

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2024-07-26-gnu-guix-journey.html b/content/posts/2024-07-26-gnu-guix-journey.html new file mode 100644 index 0000000..d4509ef --- /dev/null +++ b/content/posts/2024-07-26-gnu-guix-journey.html @@ -0,0 +1,190 @@ + + + + + + + + + + A Journey Through GNU Guix: From Installation to Returning to Arch Linux - Glenn Thompson + + + + + + + + +
+
+
+
+

A Journey Through GNU Guix: From Installation to Returning to Arch Linux

+
+ + + 7 min read + + By Glenn Thompson +
+ +
+ personaltechgnuguixswaywmnvidia +
+
+ +
+

A Journey Through GNU Guix: From Installation to Returning to Arch Linux

+

As a long-time user of Arch Linux, I decided to explore the world of GNU Guix to see if it could better suit my needs, especially with my growing interest in functional package management. The journey was insightful, filled with learning experiences, but ultimately led me back to the reliable shores of Arch. Here's a detailed account of my venture into GNU Guix, adding non-GNU channels, dealing with Nvidia drivers, running SwayWM, and the eventual retreat to Arch.

+

Installation of GNU Guix

+

The installation process of GNU Guix was straightforward, thanks to the well-documented guide provided on their official website. Here's a quick rundown of the steps I followed:

+
    +
  1. Downloading the Installation Image: I started by downloading the latest ISO image from the GNU Guix website.
  2. +
  3. Creating a Bootable USB: Using dd, I created a bootable USB stick to install GNU Guix on my system.
  4. +
  5. Booting into the Installer: Booting from the USB was smooth, and I was greeted with the GNU Guix installer. The installer's simplicity reminded me of early days with Arch, where a minimalistic approach is preferred.
  6. +
  7. Partitioning and Setting Up File Systems: I partitioned my drive using fdisk and set up my file systems. I opted for ext4 for simplicity.
  8. +
  9. Configuring the System: Following the partition setup, I proceeded to configure my system by selecting the required packages and services. I decided to go with the Sway window manager as it's my preferred choice on Arch.
  10. +
+

System Configuration

+

During the installation process a window appears informing you that the config.scm file is located at /etc/config.scm. The first time I installed gnu guix on my work laptop I missed this message (pilot error) and I had to ask in the System Crafters IRC channel at irc.libera.chat, #systemcrafters. Come and join. It's a great place to be and the community there are an absolute treasure. Use your favourite IRC client or join through the webchat here. We would be glad to see you. Tell them glenneth sent you :).

+

My point is, I missed some vital information, so to the guix manual online it was. This can be found here. This link will take you to the dev version of the manual. Something else they don't tell you. This version has a little more detail than the standard manual, and I believe details extra features and may even be a little more up to date.

+

Adding Non-GNU Channels

+

One of the standout features of GNU Guix is the ability to add non-GNU channels to access a wider array of software packages. Here's how I did it:

+
    +
  1. Editing Channels: I edited the ~/.config/guix/channels.scm file to include non-GNU channels.
    (cons* (channel
    +        (name 'non-gnu)
    +        (url "https://example.com/non-gnu-channel.git"))
    +       %default-channels)
    +
    +
  2. +
  3. Updating Channels: Running guix pull updated my system to include packages from the non-GNU channel.
  4. +
+

Installing Nvidia Drivers

+

Being a gamer and someone who requires GPU acceleration for certain tasks, Nvidia drivers were a must. Here's the process I followed:

+
    +
  1. Adding Nvidia Channel: Added a channel that includes Nvidia drivers.
  2. +
  3. Installing Drivers: Installed the drivers using guix package -i nvidia-driver.
  4. +
  5. Configuring the System: I had to manually configure Xorg to use the Nvidia drivers, which involved editing the Xorg configuration files.
  6. +
+

Creating My Home Environment

+

To personalize my setup further, I used guix home import to create my own home environment and add packages. This allowed me to have a consistent environment across different machines. I also edited the config.scm file to include the latest Linux kernels and Nvidia drivers.

+

Additionally, I used the syncthing home-service-type in my home-configuration.scm file to install and configure Syncthing. This setup ensured my files were always in sync across devices, which is crucial for my workflow.

+

GNOME

+

All was good and I had a solid desktop environment running, even though it was gnome desktop. I had never used gnome, and I am more at home with a keyboard driven workflow. I had come from hyprland on Arch and wanted to get back to that workflow. The option I was presented with, in order to continue using wayland, pipewire etc. was SwayWM.

+

Sway

+

Installing SwayWM and it's dependencies and nice to haves was relatively straightforward. add the required packages, sway, swaybg, swayidle, swaylock, to my home-configuration.scm gile and run guix home reconfigure easy! The packages were installed and we were good to go.

+

The first issue I encountered was that sway does not run with the proprietary nvidia drivers, this was on the work laptop. I could get it to run but only after adding the --unsupported-gpu flag to exec sway. Lo and behold, we had a default sway window manager running.

+

Challenges with SwayWM and SMB Shares

+

With the system set up, I ran into a major roadblock: accessing SMB shares in a file manager while running SwayWM.

+
    +
  1. Thunar and GNOME Files: Neither Thunar nor the GNOME Files application could access SMB shares. This was crucial for my workflow as I frequently access network shares.
  2. +
  3. Troubleshooting: I tried various solutions, including installing additional packages and tweaking configurations, but nothing seemed to work.
  4. +
  5. Community Support: I reached out to the GNU Guix community for help. While they were supportive, the solutions provided didn't resolve my issues.
  6. +
+

To ensure that the problem was not hardware-related, I went out and purchased a Lenovo ThinkPad E16 Gen 1. I upgraded the RAM to 48GB and installed a Lenovo 2TB SSD to make it my personal laptop. However, even on this new setup, I faced the same issues accessing SMB shares and some networking services just wouldn't work.

+

I tried deleting the gdm login manager in my system configuration file, but after rebooting it was still showing the gnome login window. This was after reading somewhere online that sway was not on friendly terms with the gdm login manager.

+

Returning to Arch Linux

+

After several days of troubleshooting and not being able to access my SMB shares reliably, I made the difficult decision to revert to Arch Linux. The steps were:

+
    +
  1. Reinstalling Arch: I reinstalled Arch Linux using my tried-and-tested setup process.
  2. +
  3. Configuring SwayWM: Set up SwayWM and ensured all my applications were running smoothly.
  4. +
  5. Accessing SMB Shares: Accessing SMB shares was seamless, just as it was before my experiment with GNU Guix.
  6. +
+

Conclusion

+

I am still running GNU guix on the work laptop, I had to cave on my personal laptop and revert to Arch. My journey with GNU Guix was both enlightening and challenging. While I appreciate the functional package management and the philosophy behind GNU Guix, certain practical issues, like accessing SMB shares, were deal-breakers for my workflow. Arch Linux continues to be my go-to distribution, providing the flexibility and reliability I need for my daily tasks. So, at the moment I am using my personal laptop for work and still trying to figure out the issues I am having on my work laptop. But, to be honest, I prefer working on the thinkpad over working on the MSI laptop that work handed out :).

+

If you're an enthusiast looking to explore new package management paradigms, I highly recommend giving GNU Guix a try. Just be prepared for a few hiccups along the way, and always have a backup plan!

+
+

Feel free to share your thoughts and experiences with GNU Guix or any other distributions you've tried. Let's keep the conversation going!

+

Shameless plug

+

Go here to find all the ways you can engage with the SystemCrafters community. It's a great place to hang out and discuss all thing craftery. You will also notice the Craftering ring that I am a part of. Click the links and see blogs by some of the community members. Always interesting to read what other Crafters are up to.

+

Thanks for taking the time to read my blog post. It is greatly appreciated, and I hope you come back.

+

Happy Hacking!!

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2024-09-24-scheme-journey.html b/content/posts/2024-09-24-scheme-journey.html new file mode 100644 index 0000000..fb05b90 --- /dev/null +++ b/content/posts/2024-09-24-scheme-journey.html @@ -0,0 +1,188 @@ + + + + + + + + + + A Journey into Scheme - Glenn Thompson + + + + + + + + +
+
+
+
+

A Journey into Scheme

+
+ + + 5 min read + + By Glenn Thompson +
+ +
+ personaltechguileschemegnudevelopment +
+
+ +
+

My Journey into Scheme: Building a Simple Symlink Manager with Guile Scheme

+

Introduction

+

I've spent my career as an electrical engineer, not a software developer. However, my recent journey in to GNU/Liniux required a tool for managing symlinks, and that's how I began learning Scheme—specifically Guile Scheme. I'm writing this post to share how I built stash, a utility that mimics GNU Stow's functionality, and how my learning journey was shaped by David Wilson's "Hands-On Guile Scheme for Beginners" course from System Crafters, more about this below.

+

How I Started with Scheme

+

My programming background was VERY limited, I produce documents in (La)Tex but I decided to take the plunge into learning Scheme, thanks to a course led by David Wilson from System Crafters. The course, "Hands-On Guile Scheme for Beginners", was incredibly helpful in making Scheme accessible even for someone like me, without a traditional programming background. I know (La)Tex isn't a programming language, it's typesetting. But how hard can it be? Right?

+

The course took me through the basics of Scheme, from simple expressions to more complex concepts like functions, recursion, and working with files. This structured learning environment gave me the confidence to start building stash.

+

The course was "instructor-led" with live meet-up sessions weekly. David has since made this course on-demand, and will be, if not already, available at the above link. Highly recommended if you are interested in taking your first steps with scheme.

+

Why Build Stash?

+

After completing David Wilson's course, I wanted to put my newly found Guile Scheme skills into practice with a real project. It wasn't enough just to understand the language conceptually—I needed to build something tangible that solved a problem I encountered regularly in my workflow. Writing stash gave me that opportunity. It allowed me to apply what I'd learned while also deepening my understanding of file manipulation, command-line tools, and conflict resolution—all within the Guile Scheme environment.

+

After migrating to GNU/Linux and speaking with other System Crafters Community members, I found I needed a way to manage symbolic links and organize directories. Existing tools like GNU Stow helped, but I wanted to learn how such tools are built. I decided to write my own version using Guile Scheme to enhance my understanding of the language and to have more control over the functionality.

+

The goal of stash is simple: allow users to move directories and create symlinks with conflict resolution, offering options to overwrite, back up, skip, or cancel the operation.

+

Breaking Down Stash

+

The core of stash revolves around:

+
    +
  1. Moving Directories: Using Scheme's file manipulation functions, I learned how to move directories and files around.
  2. +
  3. Creating Symlinks: I implemented functions to create symlinks to the moved directories, ensuring that the original structure remains accessible.
  4. +
  5. Conflict Resolution: One of the key features I wanted was handling conflicts when a file or symlink already exists at the target location. This required prompting the user for input and responding accordingly (backup, overwrite, skip, or cancel).
  6. +
+

Here's an excerpt of the core functionality that handles moving a source directory and creating a symlink:

+
;;; Helper function to move source to target
+(define (move-source-to-target source-dir target-dir)
+  "Move the entire source directory to the target directory."
+  (let* ((source-dir (expand-home source-dir))
+         (target-dir (expand-home target-dir))
+         (source-name (basename source-dir))
+         (target-source-dir (string-append target-dir "/" source-name)))
+    (if (file-exists? target-source-dir)
+        ;; Conflict handling here...
+        ...)
+    (rename-file source-dir target-source-dir)
+    (display (format #f "Moved ~a to ~a\n" source-dir target-source-dir))))
+
+

What I Learned

+

This project taught me a lot about not just Scheme, but programming in general:

+
    +
  • File and Directory Manipulation: Scheme's file handling functions were different from what I had experienced before, but they allowed for powerful manipulation of file systems.
  • +
  • Command-Line Utilities: Scheme isn't just a language for academic exercises; you can write real, useful command-line tools with it.
  • +
  • Problem Solving: From parsing command-line arguments to resolving conflicts with existing files, every part of the program required careful thought and consideration of edge cases.
  • +
+

Guile Scheme Support Resources

+
    +
  1. Guile Scheme Documentation
    The official documentation for Guile Scheme, which includes tutorials, references, and the Guile Manual.

    +
  2. +
  3. Guile Reference Manual
    A comprehensive manual covering core language concepts, libraries, and functions available in Guile Scheme.

    +
  4. +
  5. Scheme Wiki
    A community-maintained wiki that covers various Scheme dialects, including Guile Scheme, with tutorials, guides, and general information on Scheme programming.

    +
  6. +
  7. Guile at Schemers.org
    A site dedicated to Scheme with resources, libraries, tools, and documentation for Scheme and its implementations, including Guile.

    +
  8. +
  9. System Crafters
    Led by David Wilson, System Crafters provides tutorials and blog posts on Guile Scheme and other GNU tools.

    +
  10. +
  11. Guile Users Mailing List
    Join the Guile mailing list to ask questions and engage with the Guile Scheme community.

    +
  12. +
  13. Guile Cookbook
    An unofficial GitHub repository with practical code snippets and tips for Guile Scheme, covering various common use cases and tasks.

    +
  14. +
  15. #guile and #scheme on Libera Chat IRC
    A helpful IRC channel where you can connect with other Guile users for real-time support and advice.

    +
  16. +
  17. #systemcrafters on Libera Chat IRC
    A SUPER helpful IRC channel not only for guile and scheme, there are a huge variety of different people here. Tell them glenneth sent you.

    +
  18. +
+

Next Steps

+

I am still refining stash, especially around its conflict resolution system and the way it handles symbolic links. But it's in a usable state, and I'm excited to continue iterating on it. You can check out the code on Codeberg.

+

If you're curious about Scheme and how it can be used practically, I highly recommend checking out David Wilson's course. It's been instrumental in helping me grasp the concepts I needed to build this tool. Here's the link, again :) "Hands-On Guile Scheme for Beginners"

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2024-12-03-practical-scheme.html b/content/posts/2024-12-03-practical-scheme.html new file mode 100644 index 0000000..1cc59bb --- /dev/null +++ b/content/posts/2024-12-03-practical-scheme.html @@ -0,0 +1,268 @@ + + + + + + + + + + Beyond Theory: Building Practical Tools with Guile Scheme - Glenn Thompson + + + + + + + + +
+
+
+
+

Beyond Theory: Building Practical Tools with Guile Scheme

+
+ + + 5 min read + + By Glenn Thompson +
+ +
+ techguileschemedevelopmentfunctional-programming +
+
+ +
+

Beyond Theory: Building Practical Tools with Guile Scheme

+

Introduction

+

A few months ago, I shared my journey into learning Scheme through building stash, a symlink manager. Since then, I've discovered that the gap between learning Scheme and applying it to real-world problems is where the most valuable lessons emerge. This post explores what I've learned about building practical tools with Guile Scheme, sharing both successes and challenges along the way.

+

The Power of Modular Design

+

One of the most important lessons I learned was the value of modular design. Breaking down a program into focused, single-responsibility modules not only makes the code more maintainable but also helps in reasoning about the program's behavior. Here's how I structured stash:

+
(use-modules (ice-9 getopt-long)
+             (stash help)         ;; Help module
+             (stash colors)       ;; ANSI colors
+             (stash log)          ;; Logging module
+             (stash paths)        ;; Path handling module
+             (stash conflict)     ;; Conflict resolution module
+             (stash file-ops))    ;; File and symlink operations module
+
+

Each module has a specific responsibility:

+
    +
  • colors.scm: Handles ANSI color formatting for terminal output
  • +
  • conflict.scm: Manages conflict resolution when files already exist
  • +
  • file-ops.scm: Handles file system operations
  • +
  • help.scm: Provides usage information
  • +
  • log.scm: Manages logging operations
  • +
  • paths.scm: Handles path manipulation and normalization
  • +
+

Robust Path Handling

+

One of the first challenges in building a file management tool is handling paths correctly. Here's how I approached it:

+
(define (expand-home path)
+  "Expand ~ to the user's home directory."
+  (if (string-prefix? "~" path)
+      (string-append (getenv "HOME") (substring path 1))
+      path))
+
+(define (concat-path base path)
+  "Concatenate two paths, ensuring there are no double slashes."
+  (if (string-suffix? "/" base)
+      (string-append (string-drop-right base 1) "/" path)
+      (string-append base "/" path)))
+
+(define (ensure-config-path target-dir)
+  "Ensure that the target directory has .config appended, avoiding double slashes."
+  (let ((target-dir (expand-home target-dir)))
+    (if (string-suffix? "/" target-dir)
+        (set! target-dir (string-drop-right target-dir 1)))
+    (if (not (string-suffix? "/.config" target-dir))
+        (string-append target-dir "/.config")
+        target-dir)))
+
+

This approach ensures that:

+
    +
  • Home directory references (~) are properly expanded
  • +
  • Path concatenation doesn't create double slashes
  • +
  • Configuration paths are consistently structured
  • +
+

Interactive Conflict Resolution

+

Real-world tools often need to handle conflicts. I implemented an interactive conflict resolution system:

+
(define (prompt-user-for-action)
+  "Prompt the user to decide how to handle a conflict: overwrite (o), skip (s), or cancel (c)."
+  (display (color-message 
+    "A conflict was detected. Choose action - Overwrite (o), Skip (s), or Cancel (c): " 
+    yellow-text))
+  (let ((response (read-line)))
+    (cond
+      ((string-ci=? response "o") 'overwrite)
+      ((string-ci=? response "s") 'skip)
+      ((string-ci=? response "c") 'cancel)
+      (else
+       (display "Invalid input. Please try again.\n")
+       (prompt-user-for-action)))))
+
+

This provides a user-friendly interface for resolving conflicts while maintaining data safety.

+

Logging for Debugging and Auditing

+

Proper logging is crucial for debugging and auditing. I implemented a simple but effective logging system:

+
(define (current-timestamp)
+  "Return the current date and time as a formatted string."
+  (let* ((time (current-time))
+         (seconds (time-second time)))
+    (strftime "%Y-%m-%d-%H-%M-%S" (localtime seconds))))
+
+(define (log-action message)
+  "Log an action with a timestamp to the stash.log file."
+  (let ((log-port (open-file "stash.log" "a")))
+    (display (color-message 
+      (string-append "[" (current-timestamp) "] " message) 
+      green-text) log-port)
+    (newline log-port)
+    (close-port log-port)))
+
+

This logging system:

+
    +
  • Timestamps each action
  • +
  • Uses color coding for better readability
  • +
  • Maintains a persistent log file
  • +
  • Properly handles file operations
  • +
+

File Operations with Safety

+

When dealing with file system operations, safety is paramount. Here's how I handle moving directories:

+
(define (move-source-to-target source-dir target-dir)
+  "Move the entire source directory to the target directory, ensuring .config in the target path."
+  (let* ((target-dir (ensure-config-path target-dir))
+         (source-dir (expand-home source-dir))
+         (source-name (basename source-dir))
+         (target-source-dir (concat-path target-dir source-name)))
+    (if (not (file-exists? target-dir))
+        (mkdir target-dir #o755))
+    (if (file-exists? target-source-dir)
+        (handle-conflict target-source-dir source-dir delete-directory log-action)
+        (begin
+          (rename-file source-dir target-source-dir)
+          (display (format #f "Moved ~a to ~a\n" source-dir target-source-dir))
+          (log-action (format #f "Moved ~a to ~a" source-dir target-source-dir))))
+    target-source-dir))
+
+

This implementation:

+
    +
  • Ensures paths are properly formatted
  • +
  • Creates necessary directories
  • +
  • Handles conflicts gracefully
  • +
  • Logs all operations
  • +
  • Returns the new path for further operations
  • +
+

Lessons Learned

+

What Worked Well

+
    +
  1. Modular Design: Breaking the code into focused modules made it easier to maintain and test
  2. +
  3. Functional Approach: Using pure functions where possible made the code more predictable
  4. +
  5. Interactive Interface: Providing clear user prompts and colored output improved usability
  6. +
  7. Robust Logging: Detailed logging helped with debugging and understanding program flow
  8. +
+

Challenges Faced

+
    +
  1. Path Handling: Dealing with different path formats and edge cases required careful attention
  2. +
  3. Error States: Managing various error conditions while keeping the code clean
  4. +
  5. User Interface: Balancing between automation and user control
  6. +
  7. Documentation: Writing clear documentation that helps users understand the tool
  8. +
+

Moving Forward

+

Building stash has taught me that while functional programming principles are valuable, pragmatism is equally important. The key is finding the right balance between elegant functional code and practical solutions.

+

Resources

+
    +
  1. Guile Manual
  2. +
  3. My Previous Scheme Journey Post
  4. +
  5. System Crafters Community
  6. +
  7. Stash on Codeberg
  8. +
+

The code examples in this post are from my actual implementation of stash. Feel free to explore, use, and improve upon them!

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2025-01-02-from-haunt-to-custom.html b/content/posts/2025-01-02-from-haunt-to-custom.html new file mode 100644 index 0000000..7374269 --- /dev/null +++ b/content/posts/2025-01-02-from-haunt-to-custom.html @@ -0,0 +1,197 @@ + + + + + + + + + + From Hugo to Haunt to Custom: My Journey in Static Site Generation - Glenn Thompson + + + + + + + + +
+
+
+
+

From Hugo to Haunt to Custom: My Journey in Static Site Generation

+
+ + + 4 min read + + By Glenn Thompson +
+ +
+ webdevelopmentjavascriptstatic-sitehauntguilehugo +
+
+ +
+

My journey with static site generators has been one of continuous learning and evolution. It started with Hugo, transitioned through Haunt, and has now led me to build my own custom solution. Each step of this journey has taught me valuable lessons about web development, programming languages, and the importance of understanding the tools we use.

+

The Hugo Beginning

+

Like many "bloggers", I started with Hugo, a popular static site generator known for its speed and extensive theme ecosystem. Hugo served its purpose well, providing a robust platform for my blog with ready-made themes and a strong community.

+

The Transition to Haunt

+

My journey took an interesting turn when I joined the System Crafters Community. Through David Wilson's excellent course, Hands-On Guile Scheme for Beginners, I was introduced to the world of Scheme programming. This led me to adopt GNU Guix as my operating system, which naturally led me to Haunt, a static site generator written in Guile Scheme.

+

The transition to Haunt was motivated by several factors:

+
    +
  • Alignment with my growing interest in Scheme and functional programming
  • +
  • Integration with the GNU Guix ecosystem
  • +
  • The opportunity to write site configuration in Scheme
  • +
  • A desire for a simpler, more controllable setup
  • +
+

The Haunt Experience

+

Haunt offered a different perspective on site generation. Some highlights of my Haunt experience included:

+
    +
  • Writing site configuration in Scheme, which felt natural after learning Guile
  • +
  • Creating custom templates that matched my site's aesthetic needs
  • +
  • Learning to leverage Scheme's flexibility for site customization
  • +
  • Being part of a community that values simplicity and transparency
  • +
+

However, working with Haunt also presented challenges:

+
    +
  • Limited availability of ready-made templates
  • +
  • Need to create custom solutions for common features
  • +
  • Learning curve of Scheme for web development
  • +
+

The Move to Custom Development

+

As I became more comfortable with web development and gained a deeper understanding of static site generation, I felt ready for the next step: building my own static site generator. This decision wasn't about Haunt's limitations - it was about the desire to understand every aspect of my site's generation process and have complete control over its architecture.

+

The New Architecture

+

My custom solution combines the lessons learned from both Hugo and Haunt with modern web development practices:

+
    +
  • Modern JavaScript: Using Node.js and contemporary JavaScript tools
  • +
  • Markdown Processing: Leveraging the marked library for flexible content processing
  • +
  • Tailwind CSS: Adopting a utility-first approach to styling
  • +
  • Simple Build Process: A straightforward build script that handles all aspects of site generation
  • +
  • Development Server: Live reload functionality for immediate feedback
  • +
+

Benefits of the Custom Solution

+

Building my own solution has brought several advantages:

+
    +
  1. Complete Understanding: I now understand every aspect of my site's generation
  2. +
  3. Faster Iterations: Quick implementation of new features
  4. +
  5. Modern Development: Integration with current web development tools
  6. +
  7. Simplified Deployment: Streamlined process for updates
  8. +
  9. Better Performance: Only including features I actually need
  10. +
+

Learning Experience

+

This journey from Hugo through Haunt to a custom solution has taught me:

+
    +
  • The value of understanding different approaches to static site generation
  • +
  • The importance of choosing tools that align with your learning goals
  • +
  • How different programming paradigms (Go, Scheme, JavaScript) approach similar problems
  • +
  • The benefits of building your own tools when the learning opportunity outweighs convenience
  • +
+

Future Improvements

+

While my custom solution meets my current needs, I'm excited about potential improvements:

+
    +
  • Adding support for draft posts
  • +
  • Implementing a tag-based navigation system
  • +
  • Adding search functionality
  • +
  • Improving the build process
  • +
  • Adding image optimization
  • +
+

Conclusion

+

My journey from Hugo through Haunt to a custom solution reflects a common pattern in software development - starting with established tools, learning their principles, and eventually building your own solutions. Each step has been valuable:

+
    +
  • Hugo taught me about static site generators and their capabilities
  • +
  • Haunt introduced me to functional programming and the beauty of Scheme
  • +
  • Building my own solution has given me deep insights into web development
  • +
+

The source code for my site generator is available on GitHub. While it may not be the most feature-rich static site generator, it's perfectly tailored to my needs and represents a significant learning journey.

+

Remember, the goal of building your own tools isn't always to create something better than existing solutions - sometimes it's about the learning experience and creating something that perfectly fits your specific needs. Whether you're using Hugo, Haunt, or considering building your own solution, the most important thing is that it serves your purposes and helps you grow.

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/content/posts/2025-01-02-from-haunt-to-custom.md b/content/posts/2025-01-02-from-haunt-to-custom.md new file mode 100644 index 0000000..4780250 --- /dev/null +++ b/content/posts/2025-01-02-from-haunt-to-custom.md @@ -0,0 +1,93 @@ +--- +title: From Hugo to Haunt to Custom: My Journey in Static Site Generation +date: 2025-01-02 +tags: web, development, javascript, static-site, haunt, guile, hugo +description: A reflection on my evolving journey through static site generators - from Hugo to Haunt, and finally to building my own custom solution, highlighting the valuable lessons learned along the way. +--- + +My journey with static site generators has been one of continuous learning and evolution. It started with Hugo, transitioned through Haunt, and has now led me to build my own custom solution. Each step of this journey has taught me valuable lessons about web development, programming languages, and the importance of understanding the tools we use. + +## The Hugo Beginning + +Like many "bloggers", I started with Hugo, a popular static site generator known for its speed and extensive theme ecosystem. Hugo served its purpose well, providing a robust platform for my blog with ready-made themes and a strong community. + +## The Transition to Haunt + +My journey took an interesting turn when I joined the [System Crafters Community](https://systemcrafters.net/community/). Through David Wilson's excellent course, [Hands-On Guile Scheme for Beginners](https://systemcrafters.net/courses/hands-on-guile-scheme-beginners/), I was introduced to the world of Scheme programming. This led me to adopt GNU Guix as my operating system, which naturally led me to [Haunt](https://dthompson.us/projects/haunt.html), a static site generator written in Guile Scheme. + +The transition to Haunt was motivated by several factors: + +- Alignment with my growing interest in Scheme and functional programming +- Integration with the GNU Guix ecosystem +- The opportunity to write site configuration in Scheme +- A desire for a simpler, more controllable setup + +### The Haunt Experience + +Haunt offered a different perspective on site generation. Some highlights of my Haunt experience included: + +- Writing site configuration in Scheme, which felt natural after learning Guile +- Creating custom templates that matched my site's aesthetic needs +- Learning to leverage Scheme's flexibility for site customization +- Being part of a community that values simplicity and transparency + +However, working with Haunt also presented challenges: + +- Limited availability of ready-made templates +- Need to create custom solutions for common features +- Learning curve of Scheme for web development + +## The Move to Custom Development + +As I became more comfortable with web development and gained a deeper understanding of static site generation, I felt ready for the next step: building my own static site generator. This decision wasn't about Haunt's limitations - it was about the desire to understand every aspect of my site's generation process and have complete control over its architecture. + +## The New Architecture + +My custom solution combines the lessons learned from both Hugo and Haunt with modern web development practices: + +- **Modern JavaScript**: Using Node.js and contemporary JavaScript tools +- **Markdown Processing**: Leveraging the `marked` library for flexible content processing +- **Tailwind CSS**: Adopting a utility-first approach to styling +- **Simple Build Process**: A straightforward build script that handles all aspects of site generation +- **Development Server**: Live reload functionality for immediate feedback + +## Benefits of the Custom Solution + +Building my own solution has brought several advantages: + +1. **Complete Understanding**: I now understand every aspect of my site's generation +2. **Faster Iterations**: Quick implementation of new features +3. **Modern Development**: Integration with current web development tools +4. **Simplified Deployment**: Streamlined process for updates +5. **Better Performance**: Only including features I actually need + +## Learning Experience + +This journey from Hugo through Haunt to a custom solution has taught me: + +- The value of understanding different approaches to static site generation +- The importance of choosing tools that align with your learning goals +- How different programming paradigms (Go, Scheme, JavaScript) approach similar problems +- The benefits of building your own tools when the learning opportunity outweighs convenience + +## Future Improvements + +While my custom solution meets my current needs, I'm excited about potential improvements: + +- Adding support for draft posts +- Implementing a tag-based navigation system +- Adding search functionality +- Improving the build process +- Adding image optimization + +## Conclusion + +My journey from Hugo through Haunt to a custom solution reflects a common pattern in software development - starting with established tools, learning their principles, and eventually building your own solutions. Each step has been valuable: + +- Hugo taught me about static site generators and their capabilities +- Haunt introduced me to functional programming and the beauty of Scheme +- Building my own solution has given me deep insights into web development + +The source code for my site generator is available on [GitHub](https://github.com/glenneth1/personal-website). While it may not be the most feature-rich static site generator, it's perfectly tailored to my needs and represents a significant learning journey. + +Remember, the goal of building your own tools isn't always to create something better than existing solutions - sometimes it's about the learning experience and creating something that perfectly fits your specific needs. Whether you're using Hugo, Haunt, or considering building your own solution, the most important thing is that it serves your purposes and helps you grow. diff --git a/content/posts/test-blog-post.md b/content/posts/test-blog-post.md deleted file mode 100644 index 5171632..0000000 --- a/content/posts/test-blog-post.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Test Blog Post -date: 2025-01-02 -description: A test blog post to verify the summary generation functionality -tags: [test, blog] ---- - -# Test Blog Post - -This is a test blog post that we'll use to verify the summary generation functionality. The summary should be extracted from this first paragraph, which gives a good overview of what the post is about. - -## Section 1 - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - -## Section 2 - -Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -### Subsection - -- List item 1 -- List item 2 -- List item 3 - -## Conclusion - -This concludes our test blog post. It has all the elements we need to test summary generation: frontmatter, multiple sections, and varying content types. diff --git a/deploy/content/posts/2025-01-02-from-haunt-to-custom.html b/deploy/content/posts/2025-01-02-from-haunt-to-custom.html new file mode 100644 index 0000000..7374269 --- /dev/null +++ b/deploy/content/posts/2025-01-02-from-haunt-to-custom.html @@ -0,0 +1,197 @@ + + + + + + + + + + From Hugo to Haunt to Custom: My Journey in Static Site Generation - Glenn Thompson + + + + + + + + +
+
+
+
+

From Hugo to Haunt to Custom: My Journey in Static Site Generation

+
+ + + 4 min read + + By Glenn Thompson +
+ +
+ webdevelopmentjavascriptstatic-sitehauntguilehugo +
+
+ +
+

My journey with static site generators has been one of continuous learning and evolution. It started with Hugo, transitioned through Haunt, and has now led me to build my own custom solution. Each step of this journey has taught me valuable lessons about web development, programming languages, and the importance of understanding the tools we use.

+

The Hugo Beginning

+

Like many "bloggers", I started with Hugo, a popular static site generator known for its speed and extensive theme ecosystem. Hugo served its purpose well, providing a robust platform for my blog with ready-made themes and a strong community.

+

The Transition to Haunt

+

My journey took an interesting turn when I joined the System Crafters Community. Through David Wilson's excellent course, Hands-On Guile Scheme for Beginners, I was introduced to the world of Scheme programming. This led me to adopt GNU Guix as my operating system, which naturally led me to Haunt, a static site generator written in Guile Scheme.

+

The transition to Haunt was motivated by several factors:

+
    +
  • Alignment with my growing interest in Scheme and functional programming
  • +
  • Integration with the GNU Guix ecosystem
  • +
  • The opportunity to write site configuration in Scheme
  • +
  • A desire for a simpler, more controllable setup
  • +
+

The Haunt Experience

+

Haunt offered a different perspective on site generation. Some highlights of my Haunt experience included:

+
    +
  • Writing site configuration in Scheme, which felt natural after learning Guile
  • +
  • Creating custom templates that matched my site's aesthetic needs
  • +
  • Learning to leverage Scheme's flexibility for site customization
  • +
  • Being part of a community that values simplicity and transparency
  • +
+

However, working with Haunt also presented challenges:

+
    +
  • Limited availability of ready-made templates
  • +
  • Need to create custom solutions for common features
  • +
  • Learning curve of Scheme for web development
  • +
+

The Move to Custom Development

+

As I became more comfortable with web development and gained a deeper understanding of static site generation, I felt ready for the next step: building my own static site generator. This decision wasn't about Haunt's limitations - it was about the desire to understand every aspect of my site's generation process and have complete control over its architecture.

+

The New Architecture

+

My custom solution combines the lessons learned from both Hugo and Haunt with modern web development practices:

+
    +
  • Modern JavaScript: Using Node.js and contemporary JavaScript tools
  • +
  • Markdown Processing: Leveraging the marked library for flexible content processing
  • +
  • Tailwind CSS: Adopting a utility-first approach to styling
  • +
  • Simple Build Process: A straightforward build script that handles all aspects of site generation
  • +
  • Development Server: Live reload functionality for immediate feedback
  • +
+

Benefits of the Custom Solution

+

Building my own solution has brought several advantages:

+
    +
  1. Complete Understanding: I now understand every aspect of my site's generation
  2. +
  3. Faster Iterations: Quick implementation of new features
  4. +
  5. Modern Development: Integration with current web development tools
  6. +
  7. Simplified Deployment: Streamlined process for updates
  8. +
  9. Better Performance: Only including features I actually need
  10. +
+

Learning Experience

+

This journey from Hugo through Haunt to a custom solution has taught me:

+
    +
  • The value of understanding different approaches to static site generation
  • +
  • The importance of choosing tools that align with your learning goals
  • +
  • How different programming paradigms (Go, Scheme, JavaScript) approach similar problems
  • +
  • The benefits of building your own tools when the learning opportunity outweighs convenience
  • +
+

Future Improvements

+

While my custom solution meets my current needs, I'm excited about potential improvements:

+
    +
  • Adding support for draft posts
  • +
  • Implementing a tag-based navigation system
  • +
  • Adding search functionality
  • +
  • Improving the build process
  • +
  • Adding image optimization
  • +
+

Conclusion

+

My journey from Hugo through Haunt to a custom solution reflects a common pattern in software development - starting with established tools, learning their principles, and eventually building your own solutions. Each step has been valuable:

+
    +
  • Hugo taught me about static site generators and their capabilities
  • +
  • Haunt introduced me to functional programming and the beauty of Scheme
  • +
  • Building my own solution has given me deep insights into web development
  • +
+

The source code for my site generator is available on GitHub. While it may not be the most feature-rich static site generator, it's perfectly tailored to my needs and represents a significant learning journey.

+

Remember, the goal of building your own tools isn't always to create something better than existing solutions - sometimes it's about the learning experience and creating something that perfectly fits your specific needs. Whether you're using Hugo, Haunt, or considering building your own solution, the most important thing is that it serves your purposes and helps you grow.

+ +
+
+
+
+ + + \ No newline at end of file diff --git a/deploy/feed.xml b/deploy/feed.xml index 6422d44..84c094c 100644 --- a/deploy/feed.xml +++ b/deploy/feed.xml @@ -6,7 +6,7 @@ https://glenneth.org en-us - Fri, 06 Dec 2024 03:38:32 GMT + Thu, 02 Jan 2025 08:57:11 GMT Aesthetic Meets Ergonomics: My Deep Dive into the Glove80 Keyboard @@ -41,6 +41,89 @@ ["personal", "tech", "keyboards", "glove80"] + + From Hugo to Haunt to Custom: My Journey in Static Site Generation + A reflection on my evolving journey through static site generators - from Hugo to Haunt, and finally to building my own custom solution, highlighting the valuable lessons learned along the way. + My journey with static site generators has been one of continuous learning and evolution. It started with Hugo, transitioned through Haunt, and has now led me to build my own custom solution. Each step of this journey has taught me valuable lessons about web development, programming languages, and the importance of understanding the tools we use.

+

The Hugo Beginning

+

Like many "bloggers", I started with Hugo, a popular static site generator known for its speed and extensive theme ecosystem. Hugo served its purpose well, providing a robust platform for my blog with ready-made themes and a strong community.

+

The Transition to Haunt

+

My journey took an interesting turn when I joined the System Crafters Community. Through David Wilson's excellent course, Hands-On Guile Scheme for Beginners, I was introduced to the world of Scheme programming. This led me to adopt GNU Guix as my operating system, which naturally led me to Haunt, a static site generator written in Guile Scheme.

+

The transition to Haunt was motivated by several factors:

+
    +
  • Alignment with my growing interest in Scheme and functional programming
  • +
  • Integration with the GNU Guix ecosystem
  • +
  • The opportunity to write site configuration in Scheme
  • +
  • A desire for a simpler, more controllable setup
  • +
+

The Haunt Experience

+

Haunt offered a different perspective on site generation. Some highlights of my Haunt experience included:

+
    +
  • Writing site configuration in Scheme, which felt natural after learning Guile
  • +
  • Creating custom templates that matched my site's aesthetic needs
  • +
  • Learning to leverage Scheme's flexibility for site customization
  • +
  • Being part of a community that values simplicity and transparency
  • +
+

However, working with Haunt also presented challenges:

+
    +
  • Limited availability of ready-made templates
  • +
  • Need to create custom solutions for common features
  • +
  • Learning curve of Scheme for web development
  • +
+

The Move to Custom Development

+

As I became more comfortable with web development and gained a deeper understanding of static site generation, I felt ready for the next step: building my own static site generator. This decision wasn't about Haunt's limitations - it was about the desire to understand every aspect of my site's generation process and have complete control over its architecture.

+

The New Architecture

+

My custom solution combines the lessons learned from both Hugo and Haunt with modern web development practices:

+
    +
  • Modern JavaScript: Using Node.js and contemporary JavaScript tools
  • +
  • Markdown Processing: Leveraging the marked library for flexible content processing
  • +
  • Tailwind CSS: Adopting a utility-first approach to styling
  • +
  • Simple Build Process: A straightforward build script that handles all aspects of site generation
  • +
  • Development Server: Live reload functionality for immediate feedback
  • +
+

Benefits of the Custom Solution

+

Building my own solution has brought several advantages:

+
    +
  1. Complete Understanding: I now understand every aspect of my site's generation
  2. +
  3. Faster Iterations: Quick implementation of new features
  4. +
  5. Modern Development: Integration with current web development tools
  6. +
  7. Simplified Deployment: Streamlined process for updates
  8. +
  9. Better Performance: Only including features I actually need
  10. +
+

Learning Experience

+

This journey from Hugo through Haunt to a custom solution has taught me:

+
    +
  • The value of understanding different approaches to static site generation
  • +
  • The importance of choosing tools that align with your learning goals
  • +
  • How different programming paradigms (Go, Scheme, JavaScript) approach similar problems
  • +
  • The benefits of building your own tools when the learning opportunity outweighs convenience
  • +
+

Future Improvements

+

While my custom solution meets my current needs, I'm excited about potential improvements:

+
    +
  • Adding support for draft posts
  • +
  • Implementing a tag-based navigation system
  • +
  • Adding search functionality
  • +
  • Improving the build process
  • +
  • Adding image optimization
  • +
+

Conclusion

+

My journey from Hugo through Haunt to a custom solution reflects a common pattern in software development - starting with established tools, learning their principles, and eventually building your own solutions. Each step has been valuable:

+
    +
  • Hugo taught me about static site generators and their capabilities
  • +
  • Haunt introduced me to functional programming and the beauty of Scheme
  • +
  • Building my own solution has given me deep insights into web development
  • +
+

The source code for my site generator is available on GitHub. While it may not be the most feature-rich static site generator, it's perfectly tailored to my needs and represents a significant learning journey.

+

Remember, the goal of building your own tools isn't always to create something better than existing solutions - sometimes it's about the learning experience and creating something that perfectly fits your specific needs. Whether you're using Hugo, Haunt, or considering building your own solution, the most important thing is that it serves your purposes and helps you grow.

+]]>
+ https://glenneth.org/content/posts/2025-01-02-from-haunt-to-custom.html + https://glenneth.org/content/posts/2025-01-02-from-haunt-to-custom.html + Thu, 02 Jan 2025 00:00:00 GMT + Glenn Thompson + web, development, javascript, static-site, haunt, guile, hugo +
+ Beyond Theory: Building Practical Tools with Guile Scheme Introduction diff --git a/deploy/index.html b/deploy/index.html index 6987874..5fd60a6 100644 --- a/deploy/index.html +++ b/deploy/index.html @@ -59,139 +59,140 @@

Blog Posts

- -
+ +
Tech + webdevelopmentjavascriptstatic-sitehauntguilehugo - +

- + + From Hugo to Haunt to Custom: My Journey in Static Site Generation + +

+

My journey with static site generators has been one of continuous learning and evolution. It started with Hugo, transitioned through Haunt, and has now led me to build my own custom solution. Each ste...

+
+ webdevelopmentjavascriptstatic-sitehauntguilehugo +
+
+ + +
+
+ Tech + techguileschemedevelopmentfunctional-programming + + +
+

+ Beyond Theory: Building Practical Tools with Guile Scheme

-

A deep dive into building real-world tools with Guile Scheme, - featuring modular design, error handling, and practical solutions...

+

A few months ago, I shared my journey into learning Scheme through building stash, a symlink manager. Since then, I've discovered that the gap between learning Scheme and applying it to real-world pro...

- scheme - guile - development + techguileschemedevelopmentfunctional-programming
- -
+ + +
Tech + personaltechguileschemegnudevelopment - +

- - A Journey into Scheme: Building a Simple Symlink Manager + + A Journey into Scheme

-

Learning Guile Scheme and building a practical tool for - managing symlinks...

+

I've spent my career as an electrical engineer, not a software developer. However, my recent journey in to GNU/Liniux required a tool for managing symlinks, and that's how I began learning Scheme—spec...

- scheme - guile - gnu + personaltechguileschemegnudevelopment
- -
+ + +
Tech + personaltechgnuguixswaywmnvidia - +

- + A Journey Through GNU Guix: From Installation to Returning to Arch Linux

-

An exploration into GNU Guix, its challenges, and the - eventual return to Arch Linux...

+

As a long-time user of Arch Linux, I decided to explore the world of GNU Guix to see if it could better suit my needs, especially with my growing interest in functional package management. The journey...

- tech - gnu - linux + personaltechgnuguixswaywmnvidia
- -
+ + +
Tech + personaltechkeyboardsglove80 - +

- + Transitioning from Hugo to Haunt: Embracing Scheme and GNU Guix

-

A journey into the world of Scheme, GNU Guix, and static site - generation...

+

Hello there! I'm Glenn Thompson, and today, I want to share a significant part of my recent journey into the world of Scheme, GNU Guix, and static site generation.

- personal - tech - scheme + personaltechkeyboardsglove80
+ - - - - -
+
Tech + worktravel - +

- + + A Rollercoaster Week: From Amman to Newcastle, and back again + +

+

Two weeks ago was a whirlwind of events, taking me from the conforting embrace of Amman, Jordan to the vibrant streets of Newcastle, England. It was a journey filled with highs and lows, professional...

+
+ worktravel +
+
+ + +
+
+ Tech + personaltechkeyboardsglove80 + + +
+

+ Aesthetic Meets Ergonomics: My Deep Dive into the Glove80 Keyboard

-

An in-depth review exploring the unique design, features, and - impact on typing comfort of the Glove80 ergonomic keyboard...

+

As my career trajectory veered from being an integral member of an electrical engineering team to assuming the role of Deputy Project Manager, the nature of my daily activities underwent a significant...

- keyboards - tech + personaltechkeyboardsglove80
-
+ +
diff --git a/deploy/js/md-to-html.js b/deploy/js/md-to-html.js index 036733e..0c5fc57 100644 --- a/deploy/js/md-to-html.js +++ b/deploy/js/md-to-html.js @@ -1,6 +1,7 @@ const { marked } = require('marked'); const fs = require('fs'); const path = require('path'); +const cheerio = require('cheerio'); // Configure marked options const options = { @@ -79,7 +80,7 @@ async function convertMarkdownToHtml(mdFilePath, outputPath) { ${metadata.title || 'Blog Post'} - Glenn Thompson - + + + + + +
+
+
+
+

${metadata.title || 'Blog Post'}

+
+ + + ${readTime} min read + + By ${metadata.author || 'Glenn Thompson'} +
+ ${metadata.tags ? ` +
+ ${metadata.tags.split(',').map(tag => + `${tag.trim()}` + ).join('')} +
` : ''} +
+ +
+ ${articleContent} +
+
+
+
${footer}`; + + // Write HTML file + const htmlPath = outputPath || mdFilePath.replace('.md', '.html'); + await fs.promises.writeFile(htmlPath, html); + + console.log(`Converted ${mdFilePath} to ${htmlPath}`); + } catch (error) { + console.error('Error converting markdown to HTML:', error); + process.exit(1); + } +} + +// Function to extract summary from markdown content +function extractSummary(content, maxLength = 200) { + // Remove frontmatter + const contentWithoutFrontmatter = content.replace(/^---\n[\s\S]*?\n---\n/, ''); + + // Parse the markdown to HTML + const html = marked.parse(contentWithoutFrontmatter); + + // Use cheerio to extract text from the first paragraph + const $ = cheerio.load(html); + const firstParagraph = $('p').first().text(); + + // Truncate to maxLength and add ellipsis if needed + if (firstParagraph.length <= maxLength) { + return firstParagraph; + } + return firstParagraph.substring(0, maxLength).trim() + '...'; +} + +// Function to update index.html with blog post summaries +async function updateIndexWithSummaries() { + try { + const postsDir = path.join(process.cwd(), 'content', 'posts'); + const indexPath = path.join(process.cwd(), 'index.html'); + + // Read all markdown files + const files = await fs.promises.readdir(postsDir); + const posts = []; + + for (const file of files) { + if (file.endsWith('.md')) { + const filePath = path.join(postsDir, file); + const content = await fs.promises.readFile(filePath, 'utf8'); + + // Extract metadata + const metadata = {}; + content.replace(/^---\n([\s\S]*?)\n---\n/, (_, frontMatter) => { + frontMatter.split('\n').forEach(line => { + const [key, ...valueParts] = line.split(':'); + if (key && valueParts.length > 0) { + metadata[key.trim()] = valueParts.join(':').trim(); + } + }); + return ''; + }); + + // Extract summary + const summary = extractSummary(content); + + // Parse and format the date + let formattedDate = ''; + let isoDate = ''; + try { + // Handle date formats like "2024-04-08 16:50" or "2024-04-08" + const dateStr = metadata.date.split(' ')[0]; + const date = new Date(dateStr); + formattedDate = date.toLocaleDateString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric' + }); + isoDate = dateStr; + } catch (e) { + console.error(`Error parsing date for ${file}:`, e); + } + + // Parse tags + let tags = []; + if (metadata.tags) { + // Remove square brackets and split by commas + tags = metadata.tags.replace(/[\[\]]/g, '').split(',').map(t => t.trim().replace(/"/g, '')); + } + + posts.push({ + title: metadata.title?.replace(/"/g, '') || 'Untitled', + date: formattedDate, + isoDate, + summary, + tags, + url: `/content/posts/${path.basename(file, '.md')}.html` + }); + } + } + + // Sort posts by date (newest first) + posts.sort((a, b) => new Date(b.isoDate) - new Date(a.isoDate)); + + // Read index.html + let indexHtml = await fs.promises.readFile(indexPath, 'utf8'); + + // Create the HTML for blog posts + const postsHtml = posts.map(post => ` +
+
+ Tech + ${post.tags.map(tag => `${tag}`).join('')} + + +
+

+ + ${post.title} + +

+

${post.summary}

+
+ ${post.tags.map(tag => `${tag}`).join('')} +
+
+ `).join('\n'); + + // Find the blog posts section and replace its content + const blogSectionStart = indexHtml.indexOf('
'); + const blogSectionEnd = indexHtml.indexOf('
') + ''.length; + + if (blogSectionStart === -1 || blogSectionEnd === -1) { + console.error('Could not find blog posts section in index.html'); + return; + } + + // Replace the content between the markers + indexHtml = indexHtml.substring(0, blogSectionStart) + + '
\n' + + postsHtml + '\n' + + '
' + + indexHtml.substring(blogSectionEnd); + + // Write the updated index.html + await fs.promises.writeFile(indexPath, indexHtml); + + console.log('Successfully updated index.html with blog post summaries'); + } catch (error) { + console.error('Error updating index.html:', error); + throw error; + } +} + +// Export functions +module.exports = { + convertMarkdownToHtml, + updateIndexWithSummaries +}; + +// If running from command line +if (require.main === module) { + const mdFilePath = process.argv[2]; + const outputPath = process.argv[3]; + if (!mdFilePath) { + console.error('Please provide a markdown file path'); + process.exit(1); + } + convertMarkdownToHtml(mdFilePath, outputPath); +} diff --git a/package-lock.json b/package-lock.json index ffc0a3b..4d1108a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "devDependencies": { "@tailwindcss/typography": "^0.5.15", "autoprefixer": "^10.4.14", + "cheerio": "^1.0.0", "concurrently": "^8.0.1", "live-server": "^1.2.2", "marked": "^11.1.0", @@ -499,6 +500,13 @@ "file-uri-to-path": "1.0.0" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -646,6 +654,50 @@ "node": ">=8" } }, + "node_modules/cheerio": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=18.17" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -944,6 +996,36 @@ "node": ">= 8" } }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -1043,6 +1125,65 @@ "dev": true, "license": "MIT" }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.1.tgz", + "integrity": "sha512-xWXmuRnN9OMP6ptPd2+H0cCbcYBULa5YDTbMm/2lvkWvNA3O4wcW+GvzooqBuNM8yy6pl3VIAeJTUUWUbfI5Fw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -1088,6 +1229,33 @@ "node": ">= 0.8" } }, + "node_modules/encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -1620,6 +1788,26 @@ "node": ">= 0.4" } }, + "node_modules/htmlparser2": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "entities": "^4.5.0" + } + }, "node_modules/http-auth": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/http-auth/-/http-auth-3.1.3.tgz", @@ -1670,6 +1858,19 @@ "dev": true, "license": "MIT" }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2335,6 +2536,19 @@ "node": ">=0.10.0" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2467,6 +2681,46 @@ "dev": true, "license": "BlueOak-1.0.0" }, + "node_modules/parse5": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.1.tgz", + "integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^4.5.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "domhandler": "^5.0.3", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -3036,6 +3290,13 @@ "ret": "~0.1.10" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, "node_modules/send": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/send/-/send-1.1.0.tgz", @@ -4020,6 +4281,16 @@ "dev": true, "license": "0BSD" }, + "node_modules/undici": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.0.tgz", + "integrity": "sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, "node_modules/union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -4228,6 +4499,29 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 3b2b088..96e5069 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "tailwindcss -i ./src/input.css -o ./dist/styles.css --minify", "watch:css": "tailwindcss -i ./src/input.css -o ./dist/styles.css --watch", "serve": "live-server --port=3000 --no-browser", - "convert": "node src/js/md-to-html.js" + "convert": "node src/js/md-to-html.js", + "update-summaries": "node -e 'require(\"./src/js/md-to-html.js\").updateIndexWithSummaries()'" }, "keywords": [ "blog", @@ -21,6 +22,7 @@ "devDependencies": { "@tailwindcss/typography": "^0.5.15", "autoprefixer": "^10.4.14", + "cheerio": "^1.0.0", "concurrently": "^8.0.1", "live-server": "^1.2.2", "marked": "^11.1.0", diff --git a/src/js/md-to-html.js b/src/js/md-to-html.js index 036733e..0c5fc57 100644 --- a/src/js/md-to-html.js +++ b/src/js/md-to-html.js @@ -1,6 +1,7 @@ const { marked } = require('marked'); const fs = require('fs'); const path = require('path'); +const cheerio = require('cheerio'); // Configure marked options const options = { @@ -79,7 +80,7 @@ async function convertMarkdownToHtml(mdFilePath, outputPath) { ${metadata.title || 'Blog Post'} - Glenn Thompson - +