💾 Archived View for cadence.moe › bliz-documentation › 03-dot-bliz-scripting.bliz captured on 2023-06-14 at 14:05:28. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-08-13)
-=-=-=-=-=-=-
So far so good. You can write static files and serve them to your heart's content. What about dynamic content?
.bliz files are the killer feature of Bliz server.
The most basic idea of a .bliz file is that you write a gemtext document, and insert a bit of dynamic content somewhere in the middle of it, without it getting in your way. In more advanced cases, you can use .bliz files to call other services, serve dynamically generated images, or anything else you can think of.
% gem_header 20 text/gemini # Demo bliz file Hello world!
Don't just look at it on my server - please also copy this file into your own `serve/` so that you can play around with it yourself!
When you access this file, you should see the gemtext document rendered (without the % line displaying visually). So far so good.
That document is the same every time. Let's make it do something.
Starting a line with `%` in the document will execute a line of code in fish shell, inserting the output into the document at that point.
% gem_header 20 text/gemini # Current time The current time is... % date Isn't that something?
In this case, it runs the `date` command in the shell and adds its output into the document.
Gemini lets you fence code blocks with triple backticks ``` in the document.
Bliz lets you fence executable code with triple percents %%% in the same way.
%%% gem_header 20 text/gemini echo '# Fenced code demo'\n # This is a shell comment, so it won't display. set wordle_guess (grep -E '^[a-z]{5}