HN-like selfhosted forums
{{ define "header" }}<header> <a class="header-site-title" href="/"> <h1> {{ .Site.Name }} </h1> </a> <nav class="top-nav"> <div class="links"> <a href="/">home</a> | <a href="/submit">write</a> </div> <div class="user-details"> {{ if .Session }} {{ .Session.Username }} | <form action="/logout" method="post"> <button type="submit">logout</button> </form> {{ else }} <a href="/login">login</a> {{ end }} </div> </nav></header><style> header { padding-bottom: 1rem; border-bottom: 1px solid var(--border); } .top-nav { font-size: 1.2rem; background-color: var(--surface); width: 100%; display: flex; justify-content: space-between; } .top-nav a { color: var(--text); } .top-nav a:visited { color: var(--text); } .header-site-title { text-decoration: none; & h1 { text-decoration: none; color: var(--accent); font-weight: 400; font-size: 2rem; font-family: sans-serif; margin: 0; } } .user-details { & form { display: inline; } & button { border: 0; padding: 0; margin: 0; display: inline; text-decoration: underline; &:hover { cursor: pointer; } } }</style>{{ end }}