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("/ru/", m(controllers_pages.MainRuPageHandler(a)))

View File

@ -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,

View File

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