Live data from Hacker News

Ask HN: What is setup for your static blog generator?

news.ycombinator.com

61–70 of 98 posts

Re: Ask HN: What is setup for your static blog generator?

#61
I wrote an absolutely tiny, no-frills, blog generator in Bash. It's self-contained in that it contain everything it needs to run, including templates. Whether or not this is a good idea, I can't say, but it works for me. You can check it out at https://github.com/jozip/pot

Re: Ask HN: What is setup for your static blog generator?

#63
I use Hugo for mine; I submit posts to a gitlab repo, then the CI deploys them to Amazon S3. The setup is sort of clunky, specifically the upload step - it usually fails and for some reason it insists on trying to re-upload unchanged files, but I never get around to debugging it.

Re: Ask HN: What is setup for your static blog generator?

#65
I'm very surprised no one has mentioned GatsbyJS yet https://gatsbyjs.org.

You write your site in react, which is compiled into HTML at build time. After the user fetches the HTML, gatsby prefetches all the resources that might be needed later, so the site feels incredibly fast when navigating.

Re: Ask HN: What is setup for your static blog generator?

#68
post #50
post #45

I am using pandocomatic¹ to generate my website. It uses pandoc² to convert all kinds of input files to HTML output and pandocomatic is controlling that conversion. Applying it to a directory it converts, copies, or skip everything recursively given a flexible templating system. In the end, it gives me total control over the output and I have started using it for all my websites. ¹ Manual: https://heerdebeer.org/Soft…

The thing I've never figured out with my Pandoc-generated static sites is how to generate RSS feeds from Markdown frontmatter metadata.

For these type of task, pandocomatic supports preprocessors, postprocessors, filters, setup scripts, and cleanup scripts in its templates.

For your specific issue, and this is a general pandoc solution, filters with side effects could work. For example, you can write a filter that would extract and inspect the metadata and writes it to to an RSS XML file.

In Paru¹, the Ruby wrapper and interface to pandoc, a very naive solution could look like:

    #!/usr/bin/env ruby
    require "paru/filter"
    require "rss"

    RSS_FILE = "my-rss-file.rss"

    title = "No title"
    date = Time.now.to_s

    # Collect metadata information while filtering a document with pandoc
    Paru::Filter.run do 
        title = metadata["title"] if metadata.has_key? "title"
        date = metadata["date"] if metadata.has_key? "date"
    end

    # Create new Atom item
    new = RSS::Maker.make("atom") do |maker|
        maker.channel.author = maker.channel.about = maker.channel.title = ""
        maker.channel.updated = Time.now.to_s

        maker.items.new_item do |item|
            item.title = title
            item.updated = date
            item.link = "Some link"
        end
    end

    # Add new item to existing Atom RSS feed
    rss = RSS::Parser.parse(File.read(RSS_FILE), false)
    rss.items.concat new.items
    File.write(RSS_FILE, rss)

(My apologies for the bad code, this is my first attempt at working with RSS/Atom)

¹ https://heerdebeer.org/Software/markdown/paru/#writing-and-u...

Post reply on HN