-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dietpi-Software | Hugo: A static-site generator for building websites #6487
Open
mtekman
wants to merge
7
commits into
MichaIng:dev
Choose a base branch
from
mtekman:hugo
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
55d9683
add hugo static server
mtekman 8e89aca
shellfix
mtekman 1544a7d
common path to variable, removed git, extended first post
mtekman c6d57bc
real date
mtekman f3e0e10
added more information about configuration
mtekman 8b5e411
shellfish
mtekman 5eceef0
Update dietpi/dietpi-software
mtekman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -1012,6 +1012,12 @@ Available commands: | |||||||
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#wordpress' | ||||||||
aSOFTWARE_DEPS[$software_id]='88 89 webserver' | ||||||||
#------------------ | ||||||||
software_id=141 | ||||||||
aSOFTWARE_NAME[$software_id]='Hugo' | ||||||||
aSOFTWARE_DESC[$software_id]='A static-site generator for building websites' | ||||||||
aSOFTWARE_CATX[$software_id]=6 | ||||||||
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#hugo' | ||||||||
#------------------ | ||||||||
software_id=38 | ||||||||
aSOFTWARE_NAME[$software_id]='FreshRSS' | ||||||||
aSOFTWARE_DESC[$software_id]='self-hosted RSS feed aggregator' | ||||||||
|
@@ -7079,6 +7085,104 @@ _EOF_ | |||||||
/boot/dietpi/func/create_mysql_db wordpress wordpress "$GLOBAL_PW" | ||||||||
fi | ||||||||
|
||||||||
if To_Install 141 # Hugo | ||||||||
then | ||||||||
hdir=/mnt/dietpi_userdata/hugo | ||||||||
G_AGI hugo | ||||||||
G_EXEC mkdir -p "$hdir" | ||||||||
Create_User -d "$hdir" hugo | ||||||||
|
||||||||
G_EXEC cd "$hdir" | ||||||||
if ! [[ -d "${hdir}/mysite" ]]; then | ||||||||
G_EXEC hugo new site mysite -f toml | ||||||||
fi | ||||||||
G_EXEC cd "${hdir}/mysite" | ||||||||
if ! [[ -d themes/PaperMod ]]; then | ||||||||
Download_Install "https://github.com/adityatelange/hugo-PaperMod/archive/master.tar.gz" "${hdir}/mysite" | ||||||||
G_EXEC mv "${hdir}/mysite/hugo-PaperMod-master" "${hdir}/mysite/themes/PaperMod" | ||||||||
fi | ||||||||
|
||||||||
## Create a default config with a default theme | ||||||||
cat << _EOF_ > config.toml | ||||||||
baseURL = 'http://$(G_GET_NET ip)' | ||||||||
title = 'DietPi Test Blog' | ||||||||
languageCode = 'en-us' | ||||||||
theme = "PaperMod" | ||||||||
|
||||||||
[markup.goldmark.renderer] | ||||||||
unsafe = true | ||||||||
|
||||||||
_EOF_ | ||||||||
## Create a systemd file | ||||||||
cat << '_EOF_' > /etc/systemd/system/hugo.service | ||||||||
[Unit] | ||||||||
Description=Hugo (DietPi) | ||||||||
Wants=network-online.target | ||||||||
After=network-online.target | ||||||||
|
||||||||
[Service] | ||||||||
SyslogIdentifier=Hugo | ||||||||
User=hugo | ||||||||
LogsDirectory=hugo | ||||||||
WorkingDirectory=/mnt/dietpi_userdata/hugo/mysite | ||||||||
ExecStart=/usr/bin/hugo server -p 8131 --buildDrafts --navigateToChanged | ||||||||
|
||||||||
[Install] | ||||||||
WantedBy=multi-user.target | ||||||||
|
||||||||
_EOF_ | ||||||||
|
||||||||
## Create first post | ||||||||
G_EXEC mkdir -p "${hdir}/mysite/content/posts/" | ||||||||
cat << '_EOF_' > "${hdir}/mysite/content/posts/first.md" | ||||||||
--- | ||||||||
title: "First Post" | ||||||||
date: 2023-01-01 | ||||||||
draft: false | ||||||||
--- | ||||||||
|
||||||||
# The website is up! | ||||||||
|
||||||||
This is the first post, which was generated by running the command | ||||||||
|
||||||||
```bash | ||||||||
cd /mnt/dietpi_userdata/hugo/mysite/ | ||||||||
sudo -u hugo hugo new posts/name-of-post.md | ||||||||
## Note that the '.md' extension is important | ||||||||
``` | ||||||||
|
||||||||
You can then modify the file with a markdown editor, and it will | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. People will know, but of course any text editor will so:
Suggested change
|
||||||||
update in real time. | ||||||||
|
||||||||
e.g. `sudo -u hugo nano /mnt/dietpi_userdata/hugo/mysite/content/posts/name-of-post.md` | ||||||||
|
||||||||
Please also see the [Quick Start](https://gohugo.io/getting-started/quick-start/) | ||||||||
guide for more configuration tips! | ||||||||
|
||||||||
This also allows you to **push** markdown snippets to your DietPi | ||||||||
|
||||||||
e.g. `rsync random-note.md [email protected]:/mnt/dietpi_userdata/hugo/mysite/content/posts/` | ||||||||
|
||||||||
## Extras | ||||||||
|
||||||||
If you are an Emacs fan, you can use the | ||||||||
[ox-hugo](https://ox-hugo.scripter.co/doc/installation/) package to | ||||||||
export an org-mode sub-tree as a post, allowing you to blog on-the-fly | ||||||||
from your editor! | ||||||||
|
||||||||
# Configuration | ||||||||
|
||||||||
Hugo's themes can be changed by editing the `/mnt/dietpi_userdata/hugo/mysite/config.toml` | ||||||||
file. See the [Configuration Guide](https://gohugo.io/getting-started/configuration/) for | ||||||||
inspiration. | ||||||||
|
||||||||
Hugo server options need to be changed from the command line. This means ports, baseURL, and | ||||||||
site directory need to be edited in the systemd file, located at: `/etc/systemd/system/hugo.service` | ||||||||
|
||||||||
_EOF_ | ||||||||
G_EXEC chown hugo: -R "$hdir" | ||||||||
fi | ||||||||
|
||||||||
if To_Install 38 # FreshRSS | ||||||||
then | ||||||||
# Install required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements | ||||||||
|
@@ -13115,6 +13219,12 @@ If no WireGuard (auto)start is included, but you require it, please do the follo | |||||||
Remove_Database wordpress | ||||||||
fi | ||||||||
|
||||||||
if To_Uninstall 141 # WordPress | ||||||||
then | ||||||||
Remove_Service hugo | ||||||||
G_AGP hugo | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
fi | ||||||||
|
||||||||
if To_Uninstall 38 # FreshRSS | ||||||||
then | ||||||||
crontab -u www-data -l | grep -v '/opt/FreshRSS/app/actualize_script.php' | crontab -u www-data - | ||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really log to
/var/log/hugo
, or can it be configured to log to STDOUT instead?