feat: finish how I made this blog

This commit is contained in:
Hugo Poissonnet 2022-12-03 17:14:30 +01:00
parent 80eed4ba72
commit 72f264f7b8
4 changed files with 54 additions and 13 deletions

14
deploy.sh Normal file → Executable file
View File

@ -1,9 +1,15 @@
#!/bin/bash #!/bin/bash
# Build # Build
cd v2
hugo hugo
cd ..
# Backup current deploy # Backup current deploy
ssh home.hugopoi.net sudo yunohost backup create --apps my_webapp ssh home.hugopoi.net sudo yunohost backup create --apps my_webapp
# Deploy full legacy and new blog echo "$1"
rsync -rlgoD --checksum --verbose www/ home.hugopoi.net:/var/www/my_webapp/www/ if [[ "$1" == "--full" ]]; then
# Deploy only the new hugo blog echo "Deploy full legacy and new blog"
rsync -rlgoD --verbose --checksum --delete www/v2/ home.hugopoi.net:/var/www/my_webapp/www/v2/ rsync -rlgoD --checksum --verbose www/ home.hugopoi.net:/var/www/my_webapp/www/
else
echo "Deploy only the new hugo blog"
rsync -rlgoD --verbose --checksum --delete www/v2/ home.hugopoi.net:/var/www/my_webapp/www/v2/
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -133,17 +133,52 @@ parse HTML pages.
* [The clever mod](https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/commit/598d28551d071774007172782541e1d140b8a3c1#diff-eb630ac88267e24589fd94de0826721dff38beb4) * [The clever mod](https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/commit/598d28551d071774007172782541e1d140b8a3c1#diff-eb630ac88267e24589fd94de0826721dff38beb4)
<pre data-src="https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/raw/commit/598d28551d071774007172782541e1d140b8a3c1/www/index.php" data-range="411,439" class="line-numbers"></pre> <pre data-src="https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/raw/commit/598d28551d071774007172782541e1d140b8a3c1/www/index.php" data-range="411,439" class="line-numbers"></pre>
## The new blog with Hugo ## The new blog with Hugo
I wanted simple markdown that generate static HTML, this why I choose Hugo for my blog. I wanted simple markdown that generate static HTML, this why I choose Hugo for my blog.
1. First I add a new directory called `v2` next to the legacy blog. 1. First I add a new directory called `v2` next to the legacy blog.
2. Then you launch `hugo new site v2` this will generate the folder tree needed. 1. Then you launch `hugo new site v2` this will generate the folder tree needed.
3. I add the Cupper theme with `git submodule add https://github.com/zwbetz-gh/cupper-hugo-theme.git themes/cupper-hugo-theme` 1. I choose the Cupper theme
4. Add some custom css
5. Add some config in config.toml {{< figureCupper
img="Screenshot 2022-12-03 at 15-30-20 Cupper.png"
caption="Cupper Theme for Hugo"
command="Fit"
options="1024x500" >}}
1. I add the Cupper theme with `git submodule add https://github.com/zwbetz-gh/cupper-hugo-theme.git themes/cupper-hugo-theme`
1. Add some [custom css](https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/src/commit/80eed4ba721287f4854f26e62a094b26997b4b69/v2/static/css/cupper-hugo-tweaks.css)
<pre data-src="https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/raw/commit/80eed4ba721287f4854f26e62a094b26997b4b69/v2/static/css/cupper-hugo-tweaks.css" class="line-numbers"></pre>
1. Add some config in [`config.toml`](https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/src/branch/master/v2/config.toml)
<pre data-src="https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/raw/commit/80eed4ba721287f4854f26e62a094b26997b4b69/v2/config.toml" class="line-numbers"></pre>
1. I also upgrade prism.js for code highlight in theme itself
1. I add favicon and logo
1. Then I need to build with `hugo`
1. Deploy with rsync in yunohost
<pre data-src="https://home.hugopoi.net/gitea/hugopoi/blog.hugopoi.net/raw/branch/master/deploy.sh" class="line-numbers"></pre>
1. I add a CORS header in nginx config
of my Gitea to allow fetching code inside `<pre>` html tags
```nginx
rewrite ^/gitea$ /gitea/ permanent;
location /gitea/ {
proxy_pass http://localhost:6000/;
proxy_set_header Host $host;
proxy_buffering off;
client_max_body_size 200M;
proxy_set_header X-Real-IP $remote_addr;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
add_header 'Vary' 'Origin';
# Add CORS header for loading code in pre html tags
if ($http_origin ~* "^(http://localhost:1313|https://blog.hugopoi.net)$") {
add_header Access-Control-Allow-Origin "$http_origin";
}
}
```
Moooore to come ! Moooore to come !

@ -1 +1 @@
Subproject commit 69551a5fbda18f436dcc119b966a437897918d56 Subproject commit 2f7a0351f101684e7b0fdc1ec726499ae247f7a5