aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2022-04-29 10:36:43 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit5b52d269faa2ce2014d0feba603a2122361cf4eb (patch)
tree0b66338d18add90ccd1d100ffe9bdb1eecc7319d
parent3db517715bef6a53225c5c3c06e8fc5fd0bf71e3 (diff)
general layout organization
-rw-r--r--main.go3
-rw-r--r--routes/index.go32
-rw-r--r--routes/outbox.go73
-rw-r--r--routes/post.go145
-rw-r--r--routes/structs.go8
-rw-r--r--views/catalog.html39
-rw-r--r--views/index.html6
-rw-r--r--views/layouts/main.html26
-rw-r--r--views/npost.html80
-rw-r--r--views/nposts.html43
-rw-r--r--views/partials/general_scripts.html1
-rw-r--r--views/partials/post_nav.html7
-rw-r--r--views/partials/post_scripts.html (renamed from views/partials/postscripts.html)1
-rw-r--r--views/partials/top.html2
14 files changed, 225 insertions, 241 deletions
diff --git a/main.go b/main.go
index a08ed57..e7d79bd 100644
--- a/main.go
+++ b/main.go
@@ -102,11 +102,10 @@ func main() {
/* Routing and templates */
template := html.New("./views", ".html")
+ template.Debug(true)
TemplateFunctions(template)
- template.Reload(true)
-
app := fiber.New(fiber.Config{
AppName: "FChannel",
Views: template,
diff --git a/routes/index.go b/routes/index.go
index 5ff2bd4..23b3f39 100644
--- a/routes/index.go
+++ b/routes/index.go
@@ -21,6 +21,21 @@ func Index(ctx *fiber.Ctx) error {
}
var data PageData
+
+ col, err := webfinger.GetCollectionFromReq("https://fchan.xyz/followers")
+ if err != nil {
+ return err
+ }
+
+ if len(col.Items) > 0 {
+ data.InstanceIndex = col.Items
+ }
+
+ data.NewsItems, err = db.GetNewsFromDB(3)
+ if err != nil {
+ return err
+ }
+
data.Title = "Welcome to " + actor.PreferredUsername
data.PreferredUsername = actor.PreferredUsername
data.Boards = db.Boards
@@ -34,23 +49,14 @@ func Index(ctx *fiber.Ctx) error {
//almost certainly there is a better algorithm for this but the old one was wrong
//and I suck at math. This works at least.
data.BoardRemainer = make([]int, 3-(len(data.Boards)%3))
+
if len(data.BoardRemainer) == 3 {
data.BoardRemainer = make([]int, 0)
}
- col, err := webfinger.GetCollectionFromReq("https://fchan.xyz/followers")
- if err != nil {
- return err
- }
-
- if len(col.Items) > 0 {
- data.InstanceIndex = col.Items
- }
-
- data.NewsItems, err = db.GetNewsFromDB(3)
- if err != nil {
- return err
- }
+ data.Meta.Description = data.PreferredUsername + " a federated image board based on ActivityPub. The current version of the code running on the server is still a work-in-progress product, expect a bumpy ride for the time being. Get the server code here: https://github.com/FChannel0."
+ data.Meta.Url = data.Board.Domain
+ data.Meta.Title = data.Title
data.Themes = &config.Themes
data.ThemeCookie = getThemeCookie(ctx)
diff --git a/routes/outbox.go b/routes/outbox.go
index 1277011..4b874df 100644
--- a/routes/outbox.go
+++ b/routes/outbox.go
@@ -41,36 +41,6 @@ func OutboxGet(ctx *fiber.Ctx) error {
}
}
- var returnData PageData
-
- returnData.Board.Name = actor.Name
- returnData.Board.PrefName = actor.PreferredUsername
- returnData.Board.Summary = actor.Summary
- returnData.Board.InReplyTo = ""
- returnData.Board.To = actor.Outbox
- returnData.Board.Actor = actor
- returnData.Board.ModCred, _ = getPassword(ctx)
- returnData.Board.Domain = config.Domain
- returnData.Board.Restricted = actor.Restricted
- returnData.CurrentPage = page
- returnData.ReturnTo = "feed"
-
- returnData.Board.Post.Actor = actor.Id
-
- capt, err := db.GetRandomCaptcha()
- if err != nil {
- return err
- }
- returnData.Board.Captcha = config.Domain + "/" + capt
- returnData.Board.CaptchaCode = util.GetCaptchaCode(returnData.Board.Captcha)
-
- returnData.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername
-
- returnData.Key = config.Key
-
- returnData.Boards = db.Boards
- returnData.Posts = collection.OrderedItems
-
var offset = 15
var pages []int
pageLimit := (float64(collection.TotalItems) / float64(offset))
@@ -83,13 +53,46 @@ func OutboxGet(ctx *fiber.Ctx) error {
pages = append(pages, int(i))
}
- returnData.Pages = pages
- returnData.TotalPage = len(returnData.Pages) - 1
+ var data PageData
+ data.Board.Name = actor.Name
+ data.Board.PrefName = actor.PreferredUsername
+ data.Board.Summary = actor.Summary
+ data.Board.InReplyTo = ""
+ data.Board.To = actor.Outbox
+ data.Board.Actor = actor
+ data.Board.ModCred, _ = getPassword(ctx)
+ data.Board.Domain = config.Domain
+ data.Board.Restricted = actor.Restricted
+ data.CurrentPage = page
+ data.ReturnTo = "feed"
+
+ data.Board.Post.Actor = actor.Id
+
+ capt, err := db.GetRandomCaptcha()
+ if err != nil {
+ return err
+ }
+ data.Board.Captcha = config.Domain + "/" + capt
+ data.Board.CaptchaCode = util.GetCaptchaCode(data.Board.Captcha)
+
+ data.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername
+
+ data.Key = config.Key
+
+ data.Boards = db.Boards
+ data.Posts = collection.OrderedItems
+
+ data.Pages = pages
+ data.TotalPage = len(data.Pages) - 1
+
+ data.Meta.Description = data.Board.Summary
+ data.Meta.Url = data.Board.Actor.Id
+ data.Meta.Title = data.Title
- returnData.Themes = &config.Themes
- returnData.ThemeCookie = getThemeCookie(ctx)
+ data.Themes = &config.Themes
+ data.ThemeCookie = getThemeCookie(ctx)
return ctx.Render("nposts", fiber.Map{
- "page": returnData,
+ "page": data,
}, "layouts/main")
}
diff --git a/routes/post.go b/routes/post.go
index e074f67..8902f62 100644
--- a/routes/post.go
+++ b/routes/post.go
@@ -1,13 +1,13 @@
package routes
import (
- "fmt"
+ "regexp"
+
"github.com/FChannel0/FChannel-Server/config"
"github.com/FChannel0/FChannel-Server/db"
"github.com/FChannel0/FChannel-Server/util"
"github.com/FChannel0/FChannel-Server/webfinger"
"github.com/gofiber/fiber/v2"
- "regexp"
)
func PostGet(ctx *fiber.Ctx) error {
@@ -20,34 +20,7 @@ func PostGet(ctx *fiber.Ctx) error {
inReplyTo := actor.Id + "/" + postId
- var returnData PageData
- returnData.Board.Name = actor.Name
- returnData.Board.PrefName = actor.PreferredUsername
- returnData.Board.To = actor.Outbox
- returnData.Board.Actor = actor
- returnData.Board.Summary = actor.Summary
- returnData.Board.ModCred, _ = getPassword(ctx)
- returnData.Board.Domain = config.Domain
- returnData.Board.Restricted = actor.Restricted
- returnData.ReturnTo = "feed"
-
- capt, err := db.GetRandomCaptcha()
- if err != nil {
- return err
- }
- returnData.Board.Captcha = config.Domain + "/" + capt
- returnData.Board.CaptchaCode = util.GetCaptchaCode(returnData.Board.Captcha)
-
- returnData.Instance, err = db.GetActorFromDB(config.Domain)
- if err != nil {
- return err
- }
-
- returnData.Title = "/" + returnData.Board.Name + "/ - " + returnData.Board.PrefName
-
- returnData.Key = config.Key
-
- returnData.Boards = db.Boards
+ var data PageData
re := regexp.MustCompile("f(\\w|[!@#$%^&*<>])+-(\\w|[!@#$%^&*<>])+")
@@ -65,15 +38,15 @@ func PostGet(ctx *fiber.Ctx) error {
}
if len(followCollection.OrderedItems) > 0 {
- returnData.Board.InReplyTo = followCollection.OrderedItems[0].Id
- returnData.Posts = append(returnData.Posts, followCollection.OrderedItems[0])
+ data.Board.InReplyTo = followCollection.OrderedItems[0].Id
+ data.Posts = append(data.Posts, followCollection.OrderedItems[0])
- actor, err := webfinger.FingerActor(returnData.Board.InReplyTo)
+ actor, err := webfinger.FingerActor(data.Board.InReplyTo)
if err != nil {
return err
}
- returnData.Board.Post.Actor = actor.Id
+ data.Board.Post.Actor = actor.Id
}
} else {
collection, err := db.GetObjectByIDFromDB(inReplyTo)
@@ -82,24 +55,58 @@ func PostGet(ctx *fiber.Ctx) error {
}
if collection.Actor != nil {
- returnData.Board.Post.Actor = collection.Actor.Id
- returnData.Board.InReplyTo = inReplyTo
+ data.Board.Post.Actor = collection.Actor.Id
+ data.Board.InReplyTo = inReplyTo
if len(collection.OrderedItems) > 0 {
- returnData.Posts = append(returnData.Posts, collection.OrderedItems[0])
+ data.Posts = append(data.Posts, collection.OrderedItems[0])
}
}
}
- if len(returnData.Posts) > 0 {
- returnData.PostId = util.ShortURL(returnData.Board.To, returnData.Posts[0].Id)
+ if len(data.Posts) > 0 {
+ data.PostId = util.ShortURL(data.Board.To, data.Posts[0].Id)
}
- returnData.Themes = &config.Themes
- returnData.ThemeCookie = getThemeCookie(ctx)
+ data.Board.Name = actor.Name
+ data.Board.PrefName = actor.PreferredUsername
+ data.Board.To = actor.Outbox
+ data.Board.Actor = actor
+ data.Board.Summary = actor.Summary
+ data.Board.ModCred, _ = getPassword(ctx)
+ data.Board.Domain = config.Domain
+ data.Board.Restricted = actor.Restricted
+ data.ReturnTo = "feed"
+
+ capt, err := db.GetRandomCaptcha()
+ if err != nil {
+ return err
+ }
+ data.Board.Captcha = config.Domain + "/" + capt
+ data.Board.CaptchaCode = util.GetCaptchaCode(data.Board.Captcha)
+
+ data.Instance, err = db.GetActorFromDB(config.Domain)
+ if err != nil {
+ return err
+ }
+
+ data.Key = config.Key
+ data.Boards = db.Boards
+
+ data.Title = "/" + data.Board.Name + "/ - " + data.PostId
+
+ if len(data.Posts) > 0 {
+ data.Meta.Description = data.Posts[0].Content
+ data.Meta.Url = data.Posts[0].Id
+ data.Meta.Title = data.Posts[0].Name
+ data.Meta.Preview = data.Posts[0].Preview.Href
+ }
+
+ data.Themes = &config.Themes
+ data.ThemeCookie = getThemeCookie(ctx)
return ctx.Render("npost", fiber.Map{
- "page": returnData,
+ "page": data,
}, "layouts/main")
}
@@ -112,8 +119,6 @@ func CatalogGet(ctx *fiber.Ctx) error {
collection, err := db.GetObjectFromDBCatalog(actor.Id)
- fmt.Println(err)
-
// TODO: implement this in template functions
// "showArchive": func() bool {
// col, err := db.GetActorCollectionDBTypeLimit(collection.Actor.Id, "Archive", 1)
@@ -128,22 +133,22 @@ func CatalogGet(ctx *fiber.Ctx) error {
// return false
//},
- var returnData PageData
- returnData.Board.Name = actor.Name
- returnData.Board.PrefName = actor.PreferredUsername
- returnData.Board.InReplyTo = ""
- returnData.Board.To = actor.Outbox
- returnData.Board.Actor = actor
- returnData.Board.Summary = actor.Summary
- returnData.Board.ModCred, _ = getPassword(ctx)
- returnData.Board.Domain = config.Domain
- returnData.Board.Restricted = actor.Restricted
- returnData.Key = config.Key
- returnData.ReturnTo = "catalog"
-
- returnData.Board.Post.Actor = actor.Id
-
- returnData.Instance, err = db.GetActorFromDB(config.Domain)
+ var data PageData
+ data.Board.Name = actor.Name
+ data.Board.PrefName = actor.PreferredUsername
+ data.Board.InReplyTo = ""
+ data.Board.To = actor.Outbox
+ data.Board.Actor = actor
+ data.Board.Summary = actor.Summary
+ data.Board.ModCred, _ = getPassword(ctx)
+ data.Board.Domain = config.Domain
+ data.Board.Restricted = actor.Restricted
+ data.Key = config.Key
+ data.ReturnTo = "catalog"
+
+ data.Board.Post.Actor = actor.Id
+
+ data.Instance, err = db.GetActorFromDB(config.Domain)
if err != nil {
return err
}
@@ -152,19 +157,23 @@ func CatalogGet(ctx *fiber.Ctx) error {
if err != nil {
return err
}
- returnData.Board.Captcha = config.Domain + "/" + capt
- returnData.Board.CaptchaCode = util.GetCaptchaCode(returnData.Board.Captcha)
- returnData.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername
+ data.Board.Captcha = config.Domain + "/" + capt
+ data.Board.CaptchaCode = util.GetCaptchaCode(data.Board.Captcha)
+
+ data.Title = "/" + data.Board.Name + "/ - catalog"
- returnData.Boards = db.Boards
+ data.Boards = db.Boards
+ data.Posts = collection.OrderedItems
- returnData.Posts = collection.OrderedItems
+ data.Meta.Description = data.Board.Summary
+ data.Meta.Url = data.Board.Actor.Id
+ data.Meta.Title = data.Title
- returnData.Themes = &config.Themes
- returnData.ThemeCookie = getThemeCookie(ctx)
+ data.Themes = &config.Themes
+ data.ThemeCookie = getThemeCookie(ctx)
return ctx.Render("catalog", fiber.Map{
- "page": returnData,
+ "page": data,
}, "layouts/main")
}
diff --git a/routes/structs.go b/routes/structs.go
index c145a6d..8905e65 100644
--- a/routes/structs.go
+++ b/routes/structs.go
@@ -21,6 +21,7 @@ type PageData struct {
ReturnTo string
NewsItems []db.NewsItem
BoardRemainer []int
+ Meta Meta
Themes *[]string
ThemeCookie string
@@ -43,3 +44,10 @@ type AdminPage struct {
Themes *[]string
ThemeCookie string
}
+
+type Meta struct {
+ Title string
+ Description string
+ Url string
+ Preview string
+}
diff --git a/views/catalog.html b/views/catalog.html
index c70471e..d4ec009 100644
--- a/views/catalog.html
+++ b/views/catalog.html
@@ -1,30 +1,11 @@
-{{ define "header" }}
-<title>/{{ .page.Board.Name }}/ - catalog</title>
-<meta name="description" content="{{ .page.Board.Summary }}">
-<meta property="og:url" content="{{ .page.Board.Actor.Id }}">
-<meta property="og:site_name" content="{{ .page.Instance.PreferredUsername }}" />
-
-<meta property="og:title" content="{{ .page.Title }}">
-<meta property="og:description" content="{{ .page.Board.Summary }}">
-
-<meta name="twitter:title" content="{{ .page.Title }}">
-<meta name="twitter:description" content="{{ .page.Board.Summary }}">
-<meta name="twitter:card" content="summary_large_image">
-
-<script src="/static/js/posts.js"></script>
-{{ end }}
+{{ template "partials/top" .page }}
{{ $board := .page.Board }}
<hr>
<ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}/">Return</a>]</li>
- <!-- TODO: Implement showArchive -->
- <!-- \{\{ if showArchive }} -->
- <!-- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li> -->
- <!-- \{\{ end }} -->
- <li>[<a href="#bottom">Bottom</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}">Return</a>]</li>
+ {{ template "partials/post_nav" .page }}
</ul>
<hr>
@@ -94,16 +75,16 @@
</div>
{{ end }}
</div>
+
<hr>
<ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}/">Return</a>]</li>
- <!-- TODO: Implement showArchive -->
- <!-- \{\{ if showArchive }} -->
- <!-- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li> -->
- <!-- \{\{ end }} -->
- <li>[<a href="#top">Top</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}">Return</a>]</li>
+ {{ template "partials/post_nav" .page }}
</ul>
<hr>
+
+{{ template "partials/footer" .page }}
+{{ template "partials/general_scripts" .page }}
+{{ template "partials/post_scripts" .page }}
diff --git a/views/index.html b/views/index.html
index e928ace..2bfed28 100644
--- a/views/index.html
+++ b/views/index.html
@@ -1,6 +1,3 @@
-{{ define "header" }}
-<title>{{ .page.Title }}</title>
-{{ end }}
<div style="text-align: center; max-width: 800px; margin: 0 auto;">
<h1>{{ .page.Title }}</h1>
<p style="text-align: justify">{{ .page.PreferredUsername }} is a federated image board based on <a href="https://activitypub.rocks/">ActivityPub</a>. The current version of the code running on the server is still a work-in-progress product, expect a bumpy ride for the time being. Get the server code here: <a href="https://github.com/FChannel0">https://github.com/FChannel0</a>.</p>
@@ -54,3 +51,6 @@
</table>
</div>
</div>
+
+{{ template "partials/footer" .page }}
+{{ template "partials/general_scripts" .page }}
diff --git a/views/layouts/main.html b/views/layouts/main.html
index 41e3412..74b86e4 100644
--- a/views/layouts/main.html
+++ b/views/layouts/main.html
@@ -1,12 +1,32 @@
<!DOCTYPE html>
<html>
<head>
+ <title>{{ .page.Title }}</title>
<meta charset="UTF-8">
+ <meta name='robots' content='noindex, nofollow'/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="Federated Imageboard based on Activtypub">
+ <meta name="description" content="{{ .page.Meta.Description }}">
+ <meta property="og:url" content="{{ .page.Meta.Url }}">
+ <meta property="og:site_name" content="{{ .page.Instance.PreferredUsername }}" />
+
+ <meta property="og:title" content="{{ .page.Meta.Title }}">
+ <meta property="og:description" content="{{ .page.Meta.Description }}">
+
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
+
+ <meta name="twitter:title" content="{{ .page.Meta.Title }}">
+ <meta name="twitter:description" content="{{ .page.Meta.Description }}">
+ <meta name="twitter:card" content="summary_large_image">
+
+ {{ if not (eq .page.Meta.Preview "") }}
+ <meta property="og:image" content="{{ .page.Meta.Preview }}" />
+ <meta name="twitter:image" content="{{ .page.Meta.Preview }}" />
+ {{ end }}
+
<link rel="icon" type="image/png" href="/static/favicon.png">
+
{{ if gt (len .page.ThemeCookie) 0 }}
<link rel="stylesheet" type="text/css" href="/static/css/themes/{{.page.ThemeCookie}}.css" title="selected theme">
{{ else }}
@@ -15,8 +35,6 @@
{{ range .page.Themes }}
<link rel="alternate stylesheet" type="text/css" href="/static/css/themes/{{.}}.css" title="{{.}}" disabled>
{{ end }}
-
- {{ template "header" .page }}
</head>
<body {{ if not .page.Board.Restricted }}class="nsfw"{{ end }} onload="applyTheme()">
<ul id="boardlinks">
@@ -41,9 +59,5 @@
{{ end }}
{{ embed }}
-
- {{ template "partials/footer" .page }}
-
- <script src="/static/js/themes.js"></script>
</body>
</html>
diff --git a/views/npost.html b/views/npost.html
index 5a382ed..07de021 100644
--- a/views/npost.html
+++ b/views/npost.html
@@ -1,33 +1,13 @@
-{{ define "header" }}
-<title>/{{ .Board.Name }}/ - {{ .PostId }}</title>
-<meta name="description" content="{{ (index .Posts 0).Content }}">
-<meta property="og:url" content="{{ (index .Posts 0).Id }}">
-<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" />
-
-<meta property="og:title" content="{{ (index .Posts 0).Name }}">
-<meta property="og:description" content="{{ (index .Posts 0).Content }}">
-
-<meta name="twitter:title" content="{{ (index .Posts 0).Name }}">
-<meta name="twitter:description" content="{{ (index .Posts 0).Content }}">
-<meta name="twitter:card" content="summary_large_image">
-
-{{ if (index .Posts 0).Preview }}
-<meta property="og:image" content="{{ (index .Posts 0).Preview.Href }}" />
-<meta name="twitter:image" content="{{ (index .Posts 0).Preview.Href }}" />
-{{ end }}
-{{ end }}
-
{{ template "partials/top" .page }}
-{{ $board := .Board }}
-
<hr>
+
<ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}">Return</a>]</li>
- <li>[<a href="/{{ $board.Name }}/catalog">Catalog</a>]</li>
- <li>[<a href="#bottom">Bottom</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}">Return</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}/catalog">Catalog</a>]</li>
+ {{ template "partials/post_nav" .page }}
</ul>
+
<hr>
{{ template "partials/posts" .page }}
@@ -35,32 +15,34 @@
<hr>
<table id="threadfooter"><tr>
- <td>
- <ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}">Return</a>]</li>
- <li>[<a href="/{{ $board.Name }}/catalog">Catalog</a>]</li>
- <li>[<a id="bottom" href="#top">Top</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
- <li><input id="autoreload-checkbox" type="checkbox" onclick="autoTimer()"> Auto refresh <span id="autoreload-countdown" style="visibility: hidden;">0</span></li>
- </ul>
- </td>
-
- {{ if eq (index .page.Posts 0).Type "Note" }}
- <td style="text-align: center;">
- <span>[<a id="reply-content" href="javascript:quote('{{ $board.Actor.Id }}', '{{ (index .page.Posts 0).Id }}', 'reply')">Post a Reply</a>]</span>
- </td>
- {{ end }}
-
- <td>
- {{ $replies := (index .page.Posts 0).Replies }}
- <span id="threadStats" data-total="{{ $replies.TotalItems }}" data-imgs="{{ $replies.TotalImgs }}">{{ $replies.TotalItems }} / {{ $replies.TotalImgs }}</span>
- </td>
-</tr></table>
+ <tr>
+ <td>
+ <ul id="navlinks">
+ <li>[<a href="/{{ .page.Board.Name }}">Return</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}/catalog">Catalog</a>]</li>
+ {{ template "partials/post_nav" .page }}
+ <li><input id="autoreload-checkbox" type="checkbox" onclick="autoTimer()"> Auto refresh <span id="autoreload-countdown" style="visibility: hidden;">0</span></li>
+ </ul>
+ </td>
+
+ {{ if eq (index .page.Posts 0).Type "Note" }}
+ <td style="text-align: center;">
+ <span>[<a id="reply-content" href="javascript:quote('{{ .page.Board.Actor.Id }}', '{{ (index .page.Posts 0).Id }}', 'reply')">Post a Reply</a>]</span>
+ </td>
+ {{ end }}
+
+ <td>
+ {{ $replies := (index .page.Posts 0).Replies }}
+ <span id="threadStats" data-total="{{ $replies.TotalItems }}" data-imgs="{{ $replies.TotalImgs }}">{{ $replies.TotalItems }} / {{ $replies.TotalImgs }}</span>
+ </td>
+ </tr>
+</table>
<hr>
{{ template "partials/bottom" .page }}
+{{ template "partials/footer" .page }}
+{{ template "partials/general_scripts" .page }}
+{{ template "partials/post_scripts" .page }}
-{{ define "scripts" }}
-{{ template "partials/postscripts" . }}
-{{ end }}
+<script src="/static/js/timer.js"></script>
diff --git a/views/nposts.html b/views/nposts.html
index ae5a9b6..567b945 100644
--- a/views/nposts.html
+++ b/views/nposts.html
@@ -1,45 +1,21 @@
-{{ define "header" }}
-<title>{{ .Title }}</title>
-<meta name="description" content="{{ .Board.Summary }}">
-<meta property="og:url" content="{{ .Board.Actor.Id }}">
-<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" />
-
-<meta property="og:title" content="{{ .Title }}">
-<meta property="og:description" content="{{ .Board.Summary }}">
-
-<meta name="twitter:title" content="{{ .Title }}">
-<meta name="twitter:description" content="{{ .Board.Summary }}">
-<meta name="twitter:card" content="summary_large_image">
-{{ end }}
-
{{ template "partials/top" .page }}
{{ $board := .page.Board }}
<hr>
+
<ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}/catalog">Catalog</a>]</li>
- <!-- TODO: showArchive function needs to be fixed
- \{\{ if showArchive }}
- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li>
- \{\{ end }}
- -->
- <li>[<a href="#bottom">Bottom</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}/catalog">Catalog</a>]</li>
+ {{ template "partials/post_nav" .page }}
</ul>
{{ template "partials/posts" .page }}
<hr>
+
<ul id="navlinks">
- <li>[<a href="/{{ $board.Name }}/catalog">Catalog</a>]</li>
- <!-- TODO: showArchive function needs to be fixed
- \{\{ if showArchive }}
- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li>
- \{\{ end }}
- -->
- <li>[<a href="#top" id="bottom">Top</a>]</li>
- <li>[<a href="javascript:location.reload()">Refresh</a>]</li>
+ <li>[<a href="/{{ .page.Board.Name }}/catalog">Catalog</a>]</li>
+ {{ template "partials/post_nav" .page }}
</ul>
<hr>
@@ -64,7 +40,6 @@
{{ end }}
{{ template "partials/bottom" .page }}
-
-{{ define "scripts" }}
-{{ template "partials/postscripts" . }}
-{{ end }}
+{{ template "partials/footer" .page }}
+{{ template "partials/general_scripts" .page }}
+{{ template "partials/post_scripts" .page }}
diff --git a/views/partials/general_scripts.html b/views/partials/general_scripts.html
new file mode 100644
index 0000000..d59309e
--- /dev/null
+++ b/views/partials/general_scripts.html
@@ -0,0 +1 @@
+<script src="/static/js/themes.js"></script>
diff --git a/views/partials/post_nav.html b/views/partials/post_nav.html
new file mode 100644
index 0000000..eab52d1
--- /dev/null
+++ b/views/partials/post_nav.html
@@ -0,0 +1,7 @@
+<!-- TODO: showArchive function needs to be fixed
+ \{\{ if showArchive }}
+ <li>[<a href="/{{ .Board.Name }}/archive">Archive</a>]</li>
+ \{\{ end }}
+ -->
+<li>[<a href="#top" id="bottom">Top</a>]</li>
+<li>[<a href="javascript:location.reload()">Refresh</a>]</li>
diff --git a/views/partials/postscripts.html b/views/partials/post_scripts.html
index f26e354..f23255c 100644
--- a/views/partials/postscripts.html
+++ b/views/partials/post_scripts.html
@@ -1,3 +1,2 @@
<script src="/static/js/posts.js"></script>
<script src="/static/js/footerscript.js"></script>
-<script src="/static/js/timer.js"></script>
diff --git a/views/partials/top.html b/views/partials/top.html
index 7c03c36..032e86b 100644
--- a/views/partials/top.html
+++ b/views/partials/top.html
@@ -1,4 +1,4 @@
-<div style="margin: 0 auto; width: 700px;">
+<div style="max-width: 800px; margin: 0 auto;">
<h1 style="text-align: center;">/{{ .Board.Name }}/ - {{ .Board.PrefName }}</h1>
<p style="text-align: center;">{{ .Board.Summary }}</p>
{{ $len := len .Posts }}