Add gemini site builder
This commit is contained in:
parent
329e3b24f7
commit
c13d147ac6
11 changed files with 138 additions and 31 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
.jekyll-metadata
|
.jekyll-metadata
|
||||||
vendor
|
vendor
|
||||||
_site
|
_site
|
||||||
|
_capsule
|
||||||
|
|
6
Dockerfile.gemini
Normal file
6
Dockerfile.gemini
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add perl lowdown
|
||||||
|
WORKDIR /app
|
||||||
|
COPY generate_capsule.sh .
|
||||||
|
ENTRYPOINT [ "./generate_capsule.sh" ]
|
17
Makefile
17
Makefile
|
@ -12,23 +12,28 @@ stop:
|
||||||
docker compose down
|
docker compose down
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
\rm -rf .jekyll-cache _site
|
\rm -rf .jekyll-cache .saas-cache _site _capsule
|
||||||
docker compose down -v
|
docker compose down -v
|
||||||
|
|
||||||
logs:
|
logs:
|
||||||
docker compose logs --follow --since 1m
|
docker compose logs --follow --since 1m
|
||||||
|
|
||||||
build:
|
build: build-jekyll build-gemini
|
||||||
docker compose run --rm -e JEKYLL_ENV=production jekyll build
|
|
||||||
|
build-gemini:
|
||||||
|
docker compose run --rm gemini
|
||||||
|
|
||||||
|
build-jekyll:
|
||||||
|
docker compose run --rm jekyll build
|
||||||
|
|
||||||
install:
|
install:
|
||||||
docker compose run --rm --entrypoint bash jekyll -c bundle add ${args}
|
docker compose run --rm --entrypoint bash jekyll -c bundle add ${args}
|
||||||
|
|
||||||
make draft:
|
draft:
|
||||||
docker compose run --rm jekyll draft ${args}
|
docker compose run --rm jekyll draft ${args}
|
||||||
|
|
||||||
make publish:
|
publish:
|
||||||
docker compose run --rm jekyll publish ${args}
|
docker compose run --rm jekyll publish ${args}
|
||||||
|
|
||||||
make unpublish:
|
unpublish:
|
||||||
docker compose run --rm jekyll unpublish ${args}
|
docker compose run --rm jekyll unpublish ${args}
|
||||||
|
|
13
_config.yml
13
_config.yml
|
@ -2,20 +2,11 @@ title: Erick Ruiz de Chavez
|
||||||
author: Erick Ruiz de Chavez
|
author: Erick Ruiz de Chavez
|
||||||
url: https://erickruizdechavez.com
|
url: https://erickruizdechavez.com
|
||||||
|
|
||||||
site_links:
|
|
||||||
- title: 💼 LinkedIn
|
|
||||||
url: https://linkedin.com/in/erickruizdechavez
|
|
||||||
- title: 🐙 GitHub
|
|
||||||
url: https://github.com/eruizdechavez
|
|
||||||
- title: 🗣 Fediverse
|
|
||||||
url: https://erick.social/@erick
|
|
||||||
- title: 🦋 Bluesky
|
|
||||||
url: https://bsky.app/profile/erick.social
|
|
||||||
|
|
||||||
exclude:
|
exclude:
|
||||||
- Dockerfile
|
- Dockerfile*
|
||||||
- compose.yaml
|
- compose.yaml
|
||||||
- Makefile
|
- Makefile
|
||||||
|
- generate_capsule.sh
|
||||||
|
|
||||||
jekyll_compose:
|
jekyll_compose:
|
||||||
default_front_matter:
|
default_front_matter:
|
||||||
|
|
1
_includes/header.gmi
Normal file
1
_includes/header.gmi
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Erick Ruiz de Chavez
|
|
@ -5,18 +5,21 @@
|
||||||
alt="Generated Image of an anthropomorphic Panda wearing a sweater and jeans, sitting on a couch, using a laptop."
|
alt="Generated Image of an anthropomorphic Panda wearing a sweater and jeans, sitting on a couch, using a laptop."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{%- if site.site_links -%}
|
|
||||||
<nav class="site_links">
|
<nav class="site_links">
|
||||||
{%- if page.url != "/" -%}
|
{%- if page.url != "/" -%}
|
||||||
<a class="site_links__link" href="{{ "/" | relative_url }}">🏡 Front Page</a>
|
<a class="site_links__link" href="{{ "/" | relative_url }}">🏡 Front Page</a>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- for my_page in site.site_links -%}
|
<a class="site_links__link" href="https://linkedin.com/in/erickruizdechavez" rel="me noreferrer" target="_blank">
|
||||||
{%- if my_page.title -%}
|
💼 LinkedIn
|
||||||
<a class="site_links__link" href="{{ my_page.url }}" rel="me noreferrer" target="_blank">
|
</a>
|
||||||
{{ my_page.title | escape }}
|
<a class="site_links__link" href="https://github.com/eruizdechavez" rel="me noreferrer" target="_blank">
|
||||||
|
🐙 GitHub
|
||||||
|
</a>
|
||||||
|
<a class="site_links__link" href="https://erick.social/@erick" rel="me noreferrer" target="_blank">
|
||||||
|
🗣 Fediverse
|
||||||
|
</a>
|
||||||
|
<a class="site_links__link" href="https://bsky.app/profile/erick.social" rel="me noreferrer" target="_blank">
|
||||||
|
🦋 Bluesky
|
||||||
</a>
|
</a>
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
</nav>
|
</nav>
|
||||||
{%- endif -%}
|
|
||||||
</header>
|
</header>
|
||||||
|
|
6
_includes/links.gmi
Normal file
6
_includes/links.gmi
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
## Links
|
||||||
|
|
||||||
|
=> https://linkedin.com/in/erickruizdechavez LinkedIn
|
||||||
|
=> https://github.com/eruizdechavez GitHub
|
||||||
|
=> https://erick.social/@erick Fediverse
|
||||||
|
=> https://bsky.app/profile/erick.social Bluesky
|
5
_layouts/article.gmi
Normal file
5
_layouts/article.gmi
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
%%header%%
|
||||||
|
=> index.gmi Front page
|
||||||
|
## %%title%%
|
||||||
|
%%body%%
|
||||||
|
%%links%%
|
5
_layouts/home.gmi
Normal file
5
_layouts/home.gmi
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
%%header%%
|
||||||
|
%%body%%
|
||||||
|
%%articles%%
|
||||||
|
%%drafts%%
|
||||||
|
%%links%%
|
|
@ -7,3 +7,10 @@ services:
|
||||||
- 35729:35729
|
- 35729:35729
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
gemini:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.gemini
|
||||||
|
platform: linux/amd64
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
|
77
generate_capsule.sh
Executable file
77
generate_capsule.sh
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
mkdir -p _capsule
|
||||||
|
|
||||||
|
articles_list=""
|
||||||
|
|
||||||
|
header_body=$(cat _includes/header.gmi)
|
||||||
|
links_body=$(cat _includes/links.gmi)
|
||||||
|
|
||||||
|
for post in $(ls _posts/*.md); do
|
||||||
|
article_title=$(lowdown -X title $post)
|
||||||
|
article_date=$(lowdown -X date $post | awk '{print $1}')
|
||||||
|
article_body=$(lowdown -tgemini $post)
|
||||||
|
|
||||||
|
echo "Rendering post $article_title..."
|
||||||
|
|
||||||
|
gemfile=$post
|
||||||
|
gemfile=${gemfile/_posts/_capsule}
|
||||||
|
gemfile=${gemfile/.md/.gmi}
|
||||||
|
|
||||||
|
cat _layouts/article.gmi \
|
||||||
|
| perl -pe "s|%%header%%|${header_body}|" \
|
||||||
|
| perl -pe "s|%%links%%|${links_body}|" \
|
||||||
|
| perl -pe "s|%%title%%|${article_title}\n${article_date}\n|" \
|
||||||
|
| perl -pe "s|%%body%%|${article_body}|" \
|
||||||
|
> $gemfile
|
||||||
|
|
||||||
|
articles_list="$articles_list=> ${gemfile/_capsule\//} $article_date $article_title\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
drafts_list=""
|
||||||
|
|
||||||
|
if [ "${GEMINI_ENV}" != 'production' ]; then
|
||||||
|
for post in $(ls _drafts/*.md); do
|
||||||
|
article_title=$(lowdown -X title $post)
|
||||||
|
article_body=$(lowdown -tgemini $post)
|
||||||
|
|
||||||
|
echo "Rendering draft $article_title..."
|
||||||
|
|
||||||
|
gemfile=$post
|
||||||
|
gemfile=${gemfile/_drafts/_capsule}
|
||||||
|
gemfile=${gemfile/.md/.gmi}
|
||||||
|
|
||||||
|
cat _layouts/article.gmi \
|
||||||
|
| perl -pe "s|%%header%%|${header_body}|" \
|
||||||
|
| perl -pe "s|%%links%%|${links_body}|" \
|
||||||
|
| perl -pe "s|%%title%%|${article_title}|" \
|
||||||
|
| perl -pe "s|%%body%%|${article_body}|" \
|
||||||
|
> $gemfile
|
||||||
|
|
||||||
|
drafts_list="$drafts_list=> ${gemfile/_capsule\//} $article_title\n"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Rendering index..."
|
||||||
|
|
||||||
|
index_body=$(lowdown -tgemini index.md)
|
||||||
|
|
||||||
|
articles=""
|
||||||
|
if [ ! -z "$articles_list" ]; then
|
||||||
|
articles="## Articles\n\n${articles_list}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
drafts=""
|
||||||
|
if [ ! -z "$drafts_list" ]; then
|
||||||
|
drafts="## Drafts\n\n${drafts_list}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat _layouts/home.gmi \
|
||||||
|
| perl -pe "s|%%header%%|${header_body}|" \
|
||||||
|
| perl -pe "s|%%links%%|${links_body}|" \
|
||||||
|
| perl -pe "s|%%body%%|${index_body}|" \
|
||||||
|
| perl -pe "s|%%articles%%|${articles}|" \
|
||||||
|
| perl -pe "s|%%drafts%%|${drafts}|" \
|
||||||
|
> _capsule/index.gmi
|
||||||
|
|
||||||
|
echo "Done"
|
Loading…
Reference in a new issue