Do you still use Hugo as underlying static site builder?
Yes, I do. I still find it fast enough and it’s not introducing extra complexity right now.
And how do you integrate the admin bar into your site? Some JS magic?
No JS! I thought about that at first, but then I thought: well, I know when the user is logged in so it shouldn’t be that hard.
What I did was to wrap the http.ResponseWriter
when the response file is HTML and the user is logged in, and inject a <div>
with the admin bar before all the content. It’s technically not valid HTML - I think - because it goes outside of <html>
, but no browser complains about it and works perfectly.
I’m not sure if it’s the most correct strategy, but it’s working for now! :D
Replied to a post on jlelse.blog