1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

/view -> /read when published

Fixes #97
This commit is contained in:
Zack Scholl 2017-11-04 15:23:38 -06:00
parent 6eacf90e18
commit 85877602e0

View File

@ -300,6 +300,11 @@ func handlePageRequest(c *gin.Context) {
FileNames, FileSizes, FileNumChanges, FileLastEdited = DirectoryList() FileNames, FileSizes, FileNumChanges, FileLastEdited = DirectoryList()
} }
// swap out /view for /read if it is published
if p.IsPublished {
rawHTML = strings.Replace(rawHTML, "/view", "/read", -1)
}
c.HTML(http.StatusOK, "index.tmpl", gin.H{ c.HTML(http.StatusOK, "index.tmpl", gin.H{
"EditPage": command[0:2] == "/e", // /edit "EditPage": command[0:2] == "/e", // /edit
"ViewPage": command[0:2] == "/v", // /view "ViewPage": command[0:2] == "/v", // /view