jola

jola

Everyone loves a good “how I set up my blog post” blog post, so here’s mine, using Elixir, Phoenix, and NimblePublisher. For added spice it’s running on Dokploy on Hetzner, with bunny.net in front as a CDN.

Showing Posts 1 to 3

jsonbecker

jsonbecker

Fun! I redid json.blog recently but went the other way– dynamic, using MDex as my markdown processor. Mostly because of some stuff I wanted to do that wouldn’t be as easy with a static site (I was migrating from Hugo). I built some fun stuff on the admin side like book tracking/syncing using Hardcover.app to power the /books route.

My sitemap is hand rolled in a feeds context that I use for RSS and JSONfeed as well:

 @doc """
  Generates sitemap.xml content.

  ## Options

    * `:target_date` - The datetime to use for filtering published posts and page lastmod.
      Defaults to `DateTime.utc_now()`.
  """
  @spec sitemap(keyword()) :: String.t()
  def sitemap(opts \\ []) do
    now = Keyword.get(opts, :target_date, DateTime.utc_now())
    posts = Blog.list_posts(target_date: now)

    # Also include main pages
    pages = [
      %{url: "/", lastmod: now},
      %{url: "/about/", lastmod: now},
      %{url: "/archive/", lastmod: now},
      %{url: "/style-guide/", lastmod: now}
    ]

    """
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    #{Enum.map_join(pages, "\n", &sitemap_url/1)}
    #{Enum.map_join(posts, "\n", &sitemap_post_url/1)}
    </urlset>
    """
  end

  defp sitemap_url(%{url: url, lastmod: lastmod}) do
    """
      <url>
        <loc>#{@site_url}#{url}</loc>
        <lastmod>#{DateTime.to_iso8601(lastmod)}</lastmod>
      </url>
    """
  end

  defp sitemap_post_url(post) do
    """
      <url>
        <loc>#{@site_url}#{post.url_path}</loc>
        <lastmod>#{DateTime.to_iso8601(post.published_at)}</lastmod>
      </url>
    """
  end

Some improvements remain, but it’s kind of nice how easy it is to roll your own.

jola

jola OP

I gotta look into mdex, that’s a lot of recommendations I’ve gotten now in a short amount of time

krasenyp

krasenyp

We need an org-mode parser in Elixir!

— All posts loaded —

Where Next? Top

Trending in Blog Posts Top

bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
pckrishnadas88
Hey everyone! :waving_hand: I’ve published Part 7 of the Building Distributed Systems in Elixir series, where we build core distributed ...
New
zorn
An educational side project in Elixir, Phoenix, and Tauri. I share what I learned while wiring Automerge into the BEAM, including how I s...
New
mudasobwa
So, instead of wasting my afternoon arguing with anonymous handles on X, I turned to my trusty, soulless assistant and said: “Listen, ple...
New
nathanl
Process labels are useful for visualization and debugging. Here’s why you should use them.
New
abreujp
New article: Elixir Project Structure — From mix new to a Growing Codebase I’ve published a new article in my Elixir learning series on d...
New
mudasobwa
Somewhere, right now, a senior engineer is on the verge of a nervous breakdown because his company will not let him switch from Claude to...
New

Other Trending Topics Top

erlangforums
A new Erlang announcement has been posted: Original announcement:
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews