From 85877602e0c9b4d217505635f4d98a16078623f5 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sat, 4 Nov 2017 15:23:38 -0600 Subject: [PATCH] /view -> /read when published Fixes #97 --- handlers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handlers.go b/handlers.go index 587d9eb..2c836ff 100755 --- a/handlers.go +++ b/handlers.go @@ -300,6 +300,11 @@ func handlePageRequest(c *gin.Context) { 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{ "EditPage": command[0:2] == "/e", // /edit "ViewPage": command[0:2] == "/v", // /view