some changes

posts
serr 2025-04-10 17:11:14 +03:00
parent d0162ffa33
commit 13ca4c403b
3 changed files with 11 additions and 9 deletions

View File

@ -54,7 +54,7 @@ func setupRoutes(a *models.App) *http.ServeMux {
// Обработка статических файлов // Обработка статических файлов
router.Handle(a.Config.AssetsPath, m(controllers.StaticHandler())) router.Handle(a.Config.AssetsPath, m(controllers.StaticHandler()))
// Странички // Главные странички
{ {
// Обработка главной страницы (русская версия) // Обработка главной страницы (русская версия)
router.Handle("/ru/", m(controllers_pages.MainRuPageHandler(a))) router.Handle("/ru/", m(controllers_pages.MainRuPageHandler(a)))

View File

@ -14,26 +14,28 @@ const (
type Posts map[PostName]Post type Posts map[PostName]Post
func RenderPostsPage(templates *template.Template, version int64) ([]byte, error) { var (
var pageData bytes.Buffer posts = Posts{
posts := Posts{
"post 1": *NewPost( "post 1": *NewPost(
"post 1", "post 1",
"post-1", "/post-1/",
"full content 1 with more than 100 characters Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod...", "full content 1 with more than 100 characters Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod...",
), ),
"post 2": *NewPost( "post 2": *NewPost(
"post 2", "post 2",
"post-2", "/post-2/",
"full content 2", "full content 2",
), ),
"post 3": *NewPost( "post 3": *NewPost(
"post 3", "post 3",
"post-3", "/post-3/",
strings.Repeat("This is post 3 content. ", 30), 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{ context := map[string]any{
"version": version, "version": version,

View File

@ -14,7 +14,7 @@
{{ $post.Preview }} {{ $post.Preview }}
</p> </p>
<p> <p>
<a href="/{{ $post.Link }}">read more</a> <a href="{{ $post.Link }}">read more</a>
</p> </p>
<p> <p>
<code>created at: {{ $post.CreateTimestamp }}</code> <code>created at: {{ $post.CreateTimestamp }}</code>