You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blogPosts/nix-as-a-static-site-generator/main.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,17 +90,22 @@ So what this does is as follows:
90
90
7. the `checkPhase` runs a sanity check using W3C validator `vnu $out/$(slugify ${title}).html` -- this is useful to check that the page was generated OK without actually looking at the file
91
91
8. I can now preview the page in the build folder: `open result`
92
92
93
-
When I'm done, I push this to GitHub.
93
+
When I'm done, I run `git add flake.lock` and I push this to GitHub.
94
94
This does not include the page on my blog yet, but it creates an URL that I can import.
95
95
The URL looks like: `github:jhvst/jhvst.github.io?dir=blogPosts/${title}`.
96
96
97
97
I then update my main flake which generates my blog, which is found from the project root folder.
98
98
This works as follows:
99
99
100
-
1. add a new import: suppose the name of the entry is foo, then I add `foo.url = "github:jhvst/jhvst.github.io?dir=blogPosts/foo`
101
-
2. in the `buildPhase` of my root flake, I add the following lines: `mkdir -p $out/blogPosts/foo` and `cp -r ${inputs.foo.outputs.packages.${system}.default}/* $out/blogPosts/foo` -- this copies the build assets to an URL that I want to have the page
102
-
3. I update the `rss.xml` file if I want it to appear in my RSS feed
103
-
4.`git commit` and `git push` will trigger a GitHub Action which builds my site, and pushes the resulting build folder to GitHub pages
100
+
1. run `nix flake update` so that the new dir folder resolves
101
+
2. add a new import: suppose the name of the entry is foo, then I add `foo.url = "github:jhvst/jhvst.github.io?dir=blogPosts/foo`
102
+
3. in the `buildPhase` of my root flake, I add the following lines: `mkdir -p $out/blogPosts/foo` and `cp -r ${inputs.foo.outputs.packages.${system}.default}/* $out/blogPosts/foo` -- this copies the build assets to an URL that I want to have the page
103
+
4. I update the `rss.xml` file if I want it to appear in my RSS feed
104
+
5.`git commit` and `git push` will trigger a GitHub Action which builds my site, and pushes the resulting build folder to GitHub pages
104
105
105
106
Done.
107
+
To see the diffs see: [1)](https://github.com/jhvst/jhvst.github.io/commit/0d1f97099749b98c84ed48f4def454ba850d3672) and [2)](https://github.com/jhvst/jhvst.github.io/commit/977e22ccf238627eea85d6f238ca251bba2a1724).
108
+
109
+
Somewhat of a downside is that if I want to update my blog post, I always need two git pushes.
110
+
However, overall I'm quite happy with my setup and don't see why to go back anymore.
0 commit comments