Last active
April 18, 2025 18:55
-
-
Save daisyUniverse/72f307fd9d0a105cc3d80386f5cd8b1d to your computer and use it in GitHub Desktop.
Copy all files from a local nextcloud accessible drive into a jekyll blog's post folder, add the date to the filename and write the header info to the target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Jekyll Blog | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=daisy | |
| WorkingDirectory=/home/daisy/blog | |
| ExecStart=/home/daisy/gems/bin/bundle exec jekyll serve | |
| Restart=always | |
| RestartSec=5 | |
| StandardOutput=journal | |
| StandardError=journal | |
| SyslogIdentifier=jekyll | |
| Environment="GEM_HOME=/home/daisy/gems" | |
| Environment="PATH=/home/daisy/gems/bin:/usr/local/bin:/usr/bin:/bin" | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| input="/mnt/dr1/blog/" | |
| output="/home/daisy/blog/_posts" | |
| find "$input" -type f -name "*.md" -print0 | while IFS= read -r -d $'\0' file; do | |
| name=$(basename "$file" .md) | |
| date=$(ls -l --full-time --time=birth $file | awk '{print $6}') | |
| out="$output/$date-$name.md" | |
| echo "---" > $out | |
| echo "layout: post" >> $out | |
| echo "title: $name" >> $out | |
| echo "---" >> $out | |
| cat "$file" >> $out | |
| echo "Converted $file to $out" | |
| done | |
| chown -R daisy:daisy /home/daisy/blog/ | |
| systemctl restart jekyll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment