Implemented subpath support
This commit is contained in:
@@ -5,14 +5,16 @@ import (
|
||||
"TheAdversary/database"
|
||||
"github.com/gorilla/mux"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
var tmpl = template.Must(template.ParseFiles(config.ArticleTemplate))
|
||||
var tmpl = template.Must(template.ParseFiles(filepath.Join(config.FrontendDir, "html", "article.gohtml")))
|
||||
|
||||
type tmplArticle struct {
|
||||
Title string
|
||||
BasePath string
|
||||
Summary string
|
||||
Image string
|
||||
Authors []string
|
||||
@@ -37,12 +39,13 @@ func Article(w http.ResponseWriter, r *http.Request) {
|
||||
database.GetDB().Table("article_tag").Where("article_id = ?", article.Id).Find(&tags)
|
||||
|
||||
ta := tmplArticle{
|
||||
Title: article.Title,
|
||||
Summary: article.Summary,
|
||||
Image: article.Image,
|
||||
Authors: authors,
|
||||
Tags: tags,
|
||||
Content: article.Html,
|
||||
Title: article.Title,
|
||||
BasePath: config.PageBase.BasePath,
|
||||
Summary: article.Summary,
|
||||
Image: article.Image,
|
||||
Authors: authors,
|
||||
Tags: tags,
|
||||
Content: article.Html,
|
||||
}
|
||||
if article.Modified > 0 {
|
||||
ta.Date = time.Unix(article.Modified, 0).Format("Monday, 2. January 2006 | 15:04")
|
||||
|
||||
Reference in New Issue
Block a user