From e849e705c30cceec3cf7336a21bed96c8a911e90 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 8 Oct 2024 03:43:08 +0300 Subject: Добавил рейтинг Добавил страницу топа Добавил rss/xml/json feed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/tpl/quote.templ | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'pkg/tpl/quote.templ') diff --git a/pkg/tpl/quote.templ b/pkg/tpl/quote.templ index 34429d1..7b38faa 100644 --- a/pkg/tpl/quote.templ +++ b/pkg/tpl/quote.templ @@ -2,11 +2,14 @@ package tpl import ( "fmt" + "sh.org.ru/pkg/config" + "sh.org.ru/pkg/middleware" "sh.org.ru/pkg/model" "strconv" ) templ Quote(quote *model.Quote) { + {{ host := ctx.Value(middleware.ContextKey("config")).(*config.Config).Host }}
#{ strconv.Itoa(int(quote.ID)) } @@ -14,24 +17,24 @@ templ Quote(quote *model.Quote) {
@templ.Raw(quote.Text())
} templ QuotePage(quote *model.Quote) { + {{ host := ctx.Value(middleware.ContextKey("config")).(*config.Config).Host }} @Layout(HeaderParams{ - Title: "Цитата #" + strconv.Itoa(int(quote.ID)), - URL: fmt.Sprintf("https://sh.org.ru/quote/%d", quote.ID), + Title: "Цитата #" + strconv.Itoa(int(quote.ID)), + URL: fmt.Sprintf("%s/quote/%d", host, quote.ID), Description: templ.EscapeString(quote.Quote), }) { @Quote(quote) -- cgit v1.2.3