diff --git a/main.go b/main.go index 7803e6b..015f956 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,7 @@ func setupRoutes(a *models.App) *http.ServeMux { // Обработка статических файлов router.Handle(a.Config.AssetsPath, m(controllers.StaticHandler())) - // Странички + // Главные странички { // Обработка главной страницы (русская версия) router.Handle("/ru/", m(controllers_pages.MainRuPageHandler(a))) diff --git a/mvc/models/pages/posts.go b/mvc/models/pages/posts.go index c22824d..daa7507 100644 --- a/mvc/models/pages/posts.go +++ b/mvc/models/pages/posts.go @@ -14,26 +14,28 @@ const ( type Posts map[PostName]Post -func RenderPostsPage(templates *template.Template, version int64) ([]byte, error) { - var pageData bytes.Buffer - - posts := Posts{ +var ( + posts = Posts{ "post 1": *NewPost( "post 1", - "post-1", + "/post-1/", "full content 1 with more than 100 characters Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod...", ), "post 2": *NewPost( "post 2", - "post-2", + "/post-2/", "full content 2", ), "post 3": *NewPost( "post 3", - "post-3", + "/post-3/", strings.Repeat("This is post 3 content. ", 30), ), } +) + +func RenderPostsPage(templates *template.Template, version int64) ([]byte, error) { + var pageData bytes.Buffer context := map[string]any{ "version": version, diff --git a/mvc/views/pages/posts.gohtml b/mvc/views/pages/posts.gohtml index 15bd2b9..e4ebf67 100644 --- a/mvc/views/pages/posts.gohtml +++ b/mvc/views/pages/posts.gohtml @@ -14,7 +14,7 @@ {{ $post.Preview }}

- read more + read more

created at: {{ $post.CreateTimestamp }}