How to inject custom head and footer


#1

Important Notes

  • This post is based on Gogs 0.10.1.0227.

Currently, there are two places can be injected with your custom HTML without worrying about losing or conflicting with upstream updates.

Head

Create a file named custom/templates/inject/head.tmpl. It is useful for making custom head metas and importing custom static resources (e.g. custom CSS file).

The exact position it is injected into can be found here.

Footer

Create a file named custom/templates/inject/footer.tmpl. It is useful for adding custom JavaScript or tracking code from services like Google Analytics.

The exact position it is injected into can be found here.


:speech_balloon: Please leave comments if you have any questions or concerns about this post.