Proposal for a simple "Frontend Editor"

Great idea! Thanks @peaceiris :grinning:

If you start hugo server like you proposed, it works like this:

Step 1: Edit Link

The following partial must be inserted into the templates:

edit.html

{{ if .Site.IsServer }}<div style="float:right;"><a href="file://{{ .Site.Params.projectPath }}/content/{{ .File.Path }}">edit</a></div>{{ end }}

(Change from first version: add /content/ in the edit link path, change param name to »projectPath«)

config.toml: no changes needed

Step 2: Configure Firefox

see above

Step 3: Start hugo server

run:

env HUGO_PARAMS_projectPath=$(pwd) hugo server
1 Like