### previous, nextを書いていく
app.go
var start, end, previous, next int // p はcurrentのint previous = p - 1 next = p + 1 return c.Render(content, previous, next)
html
<nav class="pagination" role="navigation" aria-label="pagination"> <a href="/paging?page={{.previous}}" class="pagination-previous">Previous</a> <a href="/paging?page={{.next}}" class="pagination-next">Next page</a> </nav>
ただし、previousとnextは、currentが最初もしくは最後のページの場合、非表示にする
app.go
current = p previous = p - 1 next = p + 1
<nav class="pagination" role="navigation" aria-label="pagination"> {{if ne .current 1}} <a href="/paging?page={{.previous}}" class="pagination-previous is-left">Previous</a> {{end}} <a href="/paging?page={{.next}}" class="pagination-next is-right">Next page</a> </nav>
うわああああああああああ、条件分岐が永遠増えていく…
これは次行こう