diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..2751183 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,16 @@ + + + + + barcodes + + + + + + + +

{{ template "title" }}

+ {{ template "body" . }} + + \ No newline at end of file diff --git a/templates/help.html b/templates/help.html index 70a14f2..3b206af 100644 --- a/templates/help.html +++ b/templates/help.html @@ -1,12 +1,5 @@ - - - - - API Documentation - - -

API Requests

- +{{ define "title" }}API Documentation{{ end }} +{{ define "body" }}

API Requests can be made by making a POST request to /generate

The request body should be JSON similar to the below

@@ -37,5 +30,4 @@

content should be the value you wish the barcode to display. This should be a string and may not accept all characters - that is dependent on the barcode type.

The response will be a PNG image

- - +{{ end }} \ No newline at end of file diff --git a/web/help.route.go b/web/help.route.go index 2ee3d12..0fda164 100644 --- a/web/help.route.go +++ b/web/help.route.go @@ -22,7 +22,7 @@ func helpTemplate(w http.ResponseWriter, r *http.Request) { BarcodeOptions: barcodeOptions, } - tmpl := template.Must(template.New("help.html").ParseFiles("templates/help.html")) + tmpl := template.Must(template.New("base.html").ParseFiles("templates/base.html", "templates/help.html")) err := tmpl.Execute(w, data) if err != nil {