Skip to content

Instantly share code, notes, and snippets.

View simt2's full-sized avatar
🐔
magic is bad

Simon Tesar simt2

🐔
magic is bad
View GitHub Profile
@simt2
simt2 / base.html
Created February 21, 2017 08:13
mesh-go-example base.html
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
<meta charset="UTF-8">
<title>Gentics Mesh Demo</title>
<style>
.row.products > div {
height: 500px
}
// LoadBreadcrumb retrieves the top level nodes used to display the navigation
func LoadBreadcrumb() []gjson.Result {
r := MeshGetRequest("demo/navroot/?maxDepth=1&resolveLinks=short")
defer r.Body.Close()
bytes, _ := ioutil.ReadAll(r.Body)
json := gjson.ParseBytes(bytes).Get("root.children").Array()
return json
}
@simt2
simt2 / templateData.go
Created February 21, 2017 08:11
mesh-go-example templateData
// templateData is the struct that we pass to our HTML templates, containing
// necessary data to render pages
type templateData struct {
Breadcrumb []gjson.Result
Category *gjson.Result
Products *[]gjson.Result
}