45 lines
1.4 kB
1
tags: blog, programming, elixir, phoenix
2
3
# Building and Deploying This Blog
4
5
## Introduction
6
I didn't want to have an Ecto dependency here because I am serving static content.
7
So, I made the app LiveView but didn't add Ecto at all.
8
I have vendored the posts in to `priv` and read them all out from there with a primitive tagging system.
9
10
I will be building some more features on top of that later, but let's cover this blog as a whole.
11
12
## Building The Blog
13
I created a new project with no Ecto but LiveView flagged with `--live`.
14
From here. I told claude-3.5-sonnet to build me a blog.
15
16
The specific prompts were pretty general.
17
There was a good bit of problem solving for me to get the formatting right.
18
19
We ended up at a pretty sane model.
20
21
We have a content context, which controls the posts.
22
23
The public API is quite simple here:
24
25
```elixir
26
27
```
28
29
Now that this gets us some posts, we can make a LiveView that will display them.
30
31
Here is the heex.
32
33
```elixir
34
35
```
36
37
We store the posts in markdown and parse them live, rather than just save HTML.
38
This is low-overhead enough I hope that it just doesn't matter.
39
If it does later, I can adapt.
40
41
Posts are routed by slug, which is implicit by title in filename.
42
43
For example, `priv/static/posts/2024-03-10-14-45-00-pattern-matching-in-elixir.md` would be routed as `/post/pattern-matching-in-elixir`.
44
45
### To be continued...I am still toying with this block format
46