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

pckrishnadas88
Hey everyone! :waving_hand: I’ve published Part 7 of the Building Distributed Systems in Elixir series, where we build core distributed ...
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
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
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
jola
Wrote about how to safely run a globally unique process in an Elixir cluster, and a scary story from the past! Learn about :global for r...
New
jola
The way Phoenix is set up adding a CDN sub-domain for serving static assets, without worrying about the main dynamic content, is incredib...
New
UlfAnger
What happens when an AI agent reaches its limit because the required tool isn’t in its catalog? Normally, you get a polite refusal. I wa...
New

Other Trending Topics Top

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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews