diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/base.html | 11 | ||||
| -rw-r--r-- | templates/index.html | 6 | ||||
| -rw-r--r-- | templates/search.html | 23 |
3 files changed, 40 insertions, 0 deletions
diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..7336dda --- /dev/null +++ b/templates/base.html @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html> + <head> + <link rel="stylesheet" href="/static/style.css"> + <title>{{block "title" .}}{{end}} - grimtube</title> + </head> + <body> + {{block "content" .}} + {{end}} + </body> +</html> diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..7628712 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,6 @@ +{{define "title"}}Index{{end}} +{{define "content"}} + <form action="/search" method="get"> + <input id="term" name="term" type="text" placeholder="search" required> + </form> +{{end}} diff --git a/templates/search.html b/templates/search.html new file mode 100644 index 0000000..b921eb6 --- /dev/null +++ b/templates/search.html @@ -0,0 +1,23 @@ +{{define "title"}}Search{{end}} +{{define "content"}} + <form action="/search" method="get"> + <input id="term" name="term" type="text" placeholder="search" required> + </form> + <table> + {{range .Items}} + <tr> + <td> + <a href="{{.Url}}"><img width=120 src="{{.Thumb}}"></a> + </td> + <td> + <a href="{{.Url}}"><span>{{.Title}}</span></a> + </td> + <td> + <a href="{{.ChannelUrl}}"><span>{{.ChannelTitle}}</span></a> + </td> + </tr> + {{end}} + </table> + <a href="/search?term={{.Term}}&page={{dec .Page}}">Prev Page</a> | + <a href="/search?term={{.Term}}&page={{inc .Page}}">Next Page</a> +{{end}} |
