Markata list posts by year
━━━━━━━━━━━━━━━━━━━━━━━━━━

I was looking back at my analytics page today and wondered what were my posts about back at the beginning. My blog is managed by markata so I looked at a few...

Date: May 1, 2025

I was looking back at my [4m[38;2;248;248;242manalytics[0m <[38;2;248;248;242m/analytics/[0m> page today and wondered what were my posts about back at the beginning. My blog is managed by [4m[38;2;248;248;242mmarkata[0m <[38;2;248;248;242m/markata/[0m> so I looked at a few ways you could pull those posts up. Turns out it’s pretty simple to do, use the markata map with a filter.

[38;2;248;248;242m[code][0m
  from markata import Markata

  m.map('title, slug, date', filter='date.year==2016', sort='date')

[38;2;68;71;90mNOTE[0m
[38;2;68;71;90m│ [0m[38;2;248;248;242m[code][0m
[38;2;68;71;90m│ [0m  the filter is python eval that should evaluate to a boolean, all of the
[38;2;68;71;90m│ [0m
[38;2;68;71;90m│ [0mattributes of the post are available to filter on.

[1m[38;2;189;147;249m### Result[0m

[38;2;248;248;242m[code][0m
  [
      ('⭐ jupyterlab jupyterlab', 'jupyterlab-jupyterlab', datetime.date(2016, 12, 13)),
      ('⭐ nickhould tidy-data-python', 'nickhould-tidy-data-python', datetime.date(2016, 12, 9)),
      (
          '⭐ mikeckennedy write-pythonic-code-demos',
          'mikeckennedy-write-pythonic-code-demos',
          datetime.date(2016, 11, 22)
      ),
      (
          '⭐ mikeckennedy write-pythonic-code-for-better-data-science-webcast',
          'mikeckennedy-write-pythonic-code-for-better-data-science-webcast',
          datetime.date(2016, 11, 22)
      ),
      ('⭐ rajshah4 dlgroup', 'rajshah4-dlgroup', datetime.date(2016, 11, 18)),
      ('⭐ pandas-dev pandas', 'pandas-dev-pandas', datetime.date(2016, 10, 5))
  ]

You could use the [38;2;189;147;249mlist[0m command as well right within your shell and the same map and filters work.

[38;2;248;248;242m[code][0m
  ⬢ [devtainer-0.1.3] ❯ markata list --map title --filter='date.year==2016'
  [22:35:06] 2088/2145 posts skipped                                                                       skip.py:36
             57/2145 posts not skipped                                                                     skip.py:37

  ⭐ pandas-dev pandas
  ⭐ rajshah4 dlgroup
  ⭐ mikeckennedy write-pythonic-code-for-better-data-science-webcast
  ⭐ mikeckennedy write-pythonic-code-demos
  ⭐ nickhould tidy-data-python
  ⭐ jupyterlab jupyterlab

You could also do it with jin right inside of a markdown post using the [4m[38;2;248;248;242mjinja_md[0m <[38;2;248;248;242mhttps://markata.dev/markata/plugins/jinja-md/[0m> plugin.

[38;2;248;248;242m[code][0m
  {% raw %}
  {% for title, slug, date in markata.map('title, slug, date', filter='date.year==2016', sort='date') %}
  * [{{title}}]({{slug}}) - {{date}}
  {% endfor %}
  {% endraw %}

[38;2;68;71;90mNOTE[0m
[38;2;68;71;90m│ [0m[38;2;248;248;242m[code][0m
[38;2;68;71;90m│ [0m  You do have to `jinja: true` in the frontmatter of the post.

[1m[38;2;189;147;249m### Result[0m

{% for title, slug, date in markata.map(’title, slug, date’, filter=‘date.year==2016’, sort=‘date’) %}

- {{title}}

  - {{date}} {% endfor %}
