On Fri, Mar 21, 2025 at 10:05 AM Pon Arun Kumar R <ponarunku...@gmail.com> wrote: > > Thank you Tomas and Dave for sharing your inputs! > > I tried the following steps > 1. Downloaded haunt-0.3.0.tar.gz > 2. Extracted the source code tar -xvzf haunt-0.3.0.tar.gz > 3. tried ./configure > 4. Installed guile-3.0-dev using apt-get install guile-3.0-dev > 5. export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig > 6. ./configure > 7. make > 8. make install > 9. added the following in haunt/post.scm > (define (post-metadata-lang post) > (assq-ref (post-metadata post) 'lang)) > > (define (post-lang post) > "Return the lang of POST, or #f if no title is specified." > (post-ref post 'lang))
These procedures are redundant, you only need one of them. 'post-ref' fetches from post metadata. > And in the module definition of haunt post updated the #:export to > include post-lang and post-metadata-lang Why are modifying the Haunt source? I don't recommend this. Keep this code in your personal haunt.scm file. > 10. add the following in haunt/builder/blog.scm in the > ugly-default-post-template definition > (h2 , (post-ref post 'lang)) > (h1, (post-metadata-lang)) You should instead define the theme in your personal haunt.scm file and pass the #:theme keyword argument to the 'blog' builder. > 11. then a) ./configure b) make c) make install > 12. created the following haunt.scm under a new folder named homesite > (use-modules (haunt asset) > (haunt site) > (haunt builder blog) > (haunt builder atom) > (haunt reader commonmark)) > > (site #:title "Haunt Homesite" > #:domain "homesite.com" > #:default-metadata > '((author . "Guile User") > (email . "guileu...@guile.com")) > #:readers (list commonmark-reader) > #:builders (list (blog) > (atom-feed) > (atom-feeds-by-tag))) > 13. created the file hello.md under homesite/posts > title: My first blog post > date: 2025-03-18 18:53 > lang: en-US > author: Metadata Guile User > --- > # My First Blog Post > ## lets learn to haunt using guile > Haunt seems to be the best static site generator *SSG* using *guile* > > 14. haunt build > 13. haunt serve > 14. the rendered http://localhost:8080/my-first-blog-post.html was not > retrieving the 'en-US' value from lang: en-US keyvalue pair from the metadata > section of the markdown file hello.md > <!DOCTYPE html><head><meta charset="utf-8" /><title>My first blog post — > Haunt Homesite</title></head><body><h1>Haunt Homesite</h1><h2>My first blog > post</h2><h3>by Metadata Guile User — Tue 18 March 2025</h3><div><h1>My First > Blog Post</h1><h2>lets learn to haunt using guile</h2><p>Haunt seems to be > the best static site generator <em>SSG</em> using > <em>guile</em></p></div></body> > > 16. the changes in step 10 above were not reflected in the result in step 14. > (I am not sure how to trace and check whether the values from the .md file > are getting parsed and set into the post-metadata object. Seems like an issue with your environment. The Haunt code you are running isn't your modified version. Again, I recommend not modifying Haunt at all in this case. > Questions: > A) Do I need to try and use guix shell, download the source code for haunt, > install the guile development version and then try to configure, build and > serve the changes to test? If you aren't already using Guix for this then I don't see the need to start now. It will probably only complicate things. I like Guix a lot and recommend using it, but maybe that's something you can do *after* you have sorted out some of these other problems. > B) How to setup a development environment for this code base in VS Code so > that debugging could be enabled to see where the value is being passed? I'm not sure what value you are referring to, but I'm unaware of any VS Code integration for Guile. I use Emacs + Geiser to develop Guile code. > C) How to setup a development environment to debug haunt code base? If you really want to dig into the codebase, you can use the Guile REPL to do the things that the 'haunt' CLI is doing and get more insight into what's going on. > D) While the theme template for rendering the html is part of the blog > builder, what approach is recommended to create a module for theme template > so that based on the requirement or by updating the metadata section within > the markdown file (for example: theme: ugly-default-post-template), the > respective template could be applied? > > Expected outcome: > By incorporating the changes with attributes such as lang: en-US, translate: > yes | no and theme: ugly-default-post-template as key value pairs in the > markdown file, the rendered post is expected to be customizable and also the > overall blog with the list of posts could have multi language posts in the > same blog and could also enable translations for other languages based on the > translate: yes attribute. You should write your own blog theme. It can either be placed directly in your site's haunt.scm file or you could make it a separate module and import it in haunt.scm with (use-modules (my-theme)) or whatever. I keep my theme in a separate module: https://git.dthompson.us/blog/tree/theme.scm Hope this helps, - Dave