Skip to content

Commit

Permalink
Count posts in archive
Browse files Browse the repository at this point in the history
  • Loading branch information
treeman committed Jan 2, 2025
1 parent 83e2f6b commit b57df6c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 25 deletions.
16 changes: 10 additions & 6 deletions css/local/archive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@ article.archive {
h1 > * {
@include large-underline-highlight(var(--color-highlight-archive));
}
.tagged h1 > * {
.title-wrapper h1 > * {
@include large-underline-highlight(var(--color-highlight-tags));
}

.tagged > .tagged_by {
.title-wrapper > .pre-title {
@include sans-serif;
@include font-size("s");
color: var(--color-highlight-archive);
}

h1 {
margin-block-end: var(--space-xs);
line-height: 1.3;
.title-wrapper .post-count {
color: var(--melange_a_ui);
}

.tagged h1 {
.title-wrapper h1 {
margin-block-start: 0;
}

h1 {
margin-block-end: var(--space-xs);
line-height: 1.3;
}

.favorite-descr {
margin-block-end: var(--space-xs);

Expand Down
7 changes: 4 additions & 3 deletions drafts/2024_in_review.dj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ tags = ["Yearly Review"]

It's amazing I got anything productive done this year...

- I still really enjoy Rust.
- I really enjoy working with Rust in my own hobby projects.

- [Types are coming to Elixir][elixir_types] and I'm loving it.

(I recently migrated some small projects to v1.18 and found a bunch of errors.)

- The [Gleam programming language](https://gleam.run/) shows a lot of promise.

My one gripe is the pain of manually encoding/decoding JSON (even with the various libraries) that's is annoying enough that I've avoided using the language for some projects.
My one gripe is the pain of manually encoding/decoding JSON (even with the various libraries).
Compared to Elixir dynamic encoding or Rust's `#[derive(Deserialize)]`{lang=rust} it just feels so bad that I've avoided Gleam for some projects (shame on me?).

# Lessons I learned

Expand Down Expand Up @@ -75,7 +76,7 @@ tags = ["Yearly Review"]
[Rewrote my lighting home automation]: /blog/2024/10/08/writing_home_assistant_automations_using_genservers_in_elixir
[The Kingkiller Chronicle]: https://en.wikipedia.org/wiki/The_Kingkiller_Chronicle
[Gentlemen Bastards series]: https://en.wikipedia.org/wiki/Scott_Lynch#Gentleman_Bastard_Sequence
[virtual points on Hacker News]: https://news.ycombinator.com/item?id=41646531
[virtual points on Hacker News]: https://news.ycombinator.com/item?id=41646531
[meta-blogging]: /blog/2024/09/25/why_i_still_blog_after_15_years
[building my first 3D printer]: /series/voron_trident
[Tree-sitter grammar for Djot]: /blog/2024/03/19/lets_create_a_tree-sitter_grammar
Expand Down
23 changes: 15 additions & 8 deletions drafts/first_impressions_of_ghostty.dj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ tags = ["Linux", "Ghostty"]

```ghostty
window-decoration = false

# These are also needed to completely remove the borders
# https://github.com/ghostty-org/ghostty/issues/2023
gtk-titlebar = false
Expand Down Expand Up @@ -54,16 +53,19 @@ In [alacritty][] I've had the cursor invert the background and foreground and yo

I ran into an issue where it interferes with [indent-blankline.nvim][] making the cursor very hard to spot in indents (taking the color of the indent guides, which is by design low contrast with the background).

Annoying but it gave me the shove I needed to try out different plugins to see if the error persisted and I ended up with (an even nicer) config using [snacks.nvim][] that didn't have this issue:
Annoying but it gave me the shove I needed to try out different plugins to see if the problem persisted.
I ended up with (an even nicer) setup using [snacks.nvim][] that didn't have this issue:

![My old config using [indent-blankline.nvim][] to the left (with the cursor barely visible) and the new config using [snacks.nvim][] to the right.](/images/ghostty_indent_differences.png)
![Left: [indent-blankline.nvim][] (cursor barely visible)\
Right: [snacks.nvim][] (cursor visible and it highlights scope).
](/images/ghostty_indent_differences.png)

# Consistent font sizing between desktop and laptop

With [alacritty][] I have an annoying problem where I need to use a very different font size on my laptop and my desktop (`8` and `12`).
This wasn't always the case and I think something may have changed in [alacritty][] but I'm not sure.

[Ghostty][] handles this nicely and I can now use the same font settings across my machines (`font-size = 16`).
[Ghostty][] handles this nicely and I can now use the same font settings across my machines (`font-size = 16`{lang=ghostty}).

# Ligature support

Expand All @@ -74,7 +76,7 @@ and even though I wanted to try ligatures I couldn't be bothered to "run a "low

![My configured ligatures of Iosevka, rendered in Ghostty.](/images/iosevka_ligatures.png)

Overall I feel that the font rendering in [Ghostty][] is a little better than in [alacritty][], although that can be recency bias.
Overall I feel that the font rendering in [Ghostty][] is a little better than in [alacritty][], although that might be recency bias.
I'm still undecided on ligatures but I love that I can try them.

I use a [custom Iosevka build](/iosevka) with these [Ghostty][] settings:
Expand All @@ -90,14 +92,12 @@ font-size = 16

# Colorscheme

While [Ghostty][] has an absolutely excellent theme selector with a bunch of included themes (`ghostty +list-themes`) [melange-nvim][] wasn't included, so I had to configure that myself:
While [Ghostty][] has an absolutely excellent theme selector with a bunch of included themes (`ghostty +list-themes`) [melange-nvim][] wasn't included, so I had configured the colorscheme myself:

```ghostty
# The dark variant of melange
background = #292522
foreground = #ECE1D7
selection-background = #403a36
selection-foreground = #c1a78e
palette = 0=#867462
palette = 1=#D47766
palette = 2=#85B695
Expand All @@ -114,14 +114,21 @@ palette = 12=#7F91B2
palette = 13=#B380B0
palette = 14=#7B9695
palette = 15=#C1A78E
# I think it's nice to colorize the selection too
selection-background = #403a36
selection-foreground = #c1a78e
```

# I'm happy with Ghostty

::: note
Did I create a custom highlighter for the Ghostty configuration file just to have proper syntax highlighting for this one blog post?

Yes I did. I created a [simple treesitter grammar][ts] and included that into my blog.
Creating a simple grammar [is surprisingly straightforward](create_ts).
:::

[create_ts]: /blog/2024/03/19/lets_create_a_tree-sitter_grammar
[Ghostty]: https://github.com/ghostty-org/ghostty
[alacritty]: https://github.com/alacritty/alacritty
[alacritty-ligatures]: https://github.com/alacritty/alacritty/issues/50
Expand Down
27 changes: 19 additions & 8 deletions templates/archive.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
{% import "post_info.html" as macros %} {% extends "site.html" %} {% block
content %}
{% import "post_info.html" as macros %}
{% extends "site.html" %}
{% block content %}
<article class="archive">
{% if tag_filter %}
<div class="tagged">
<div class="tagged_by">Posts tagged</div>
<div class="title-wrapper">
<div class="pre-title">
<span class="count">{{ posts | length }}</span>
{% if posts | length == 1 %}
post
{% else %}
posts
{% endif %}

{% if tag_filter %}
tagged
{% else %}
in
{% endif %}
</div>
<h1><span>{{ title }}</span></h1>
</div>
{% else %}
<h1><span>{{ title }}</span></h1>

{% if url == "/blog" %}
<div class="favorite-descr">
My <a href="/favorite">favorite posts</a> are marked with a <span class="favorite"></span>.
</div>
{% endif %}

{% endif %} {{ macros::post_items(posts=posts) }}
{{ macros::post_items(posts=posts) }}
</article>
{% endblock content %}

0 comments on commit b57df6c

Please sign in to comment.