diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-08 03:43:08 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-08 03:50:53 +0300 |
commit | e849e705c30cceec3cf7336a21bed96c8a911e90 (patch) | |
tree | 93f559bcd4cf3e53193930d112e564a2b7462ac8 /pkg/tpl/quote.templ | |
parent | 3ee654f6fb3cdf119630bfba8066c96ec26428c3 (diff) |
Добавил рейтинг
Добавил страницу топа
Добавил rss/xml/json feed
Diffstat (limited to 'pkg/tpl/quote.templ')
-rw-r--r-- | pkg/tpl/quote.templ | 17 |
1 files changed, 10 insertions, 7 deletions
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 }} <article> <header> <a href={ templ.URL(fmt.Sprintf("/quote/%d", quote.ID)) }>#{ strconv.Itoa(int(quote.ID)) }</a> @@ -14,24 +17,24 @@ templ Quote(quote *model.Quote) { </header> @templ.Raw(quote.Text()) <footer> - <span> - <a target="_blank" href={ templ.URL(fmt.Sprintf("https://t.me/share/url?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-telegram" aria-hidden="true"></i></a> ·  - <a target="_blank" href={ templ.URL(fmt.Sprintf("https://vk.com/share.php?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-vk" aria-hidden="true"></i></a> ·  - <a target="_blank" href={ templ.URL(fmt.Sprintf("https://connect.ok.ru/offer?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-odnoklassniki-square" aria-hidden="true"></i></a> - </span> + @Rate(quote, 0) <span> if quote.Archive { <abbr title="Цитата из старого цитатника">Архив</abbr> } + <a target="_blank" href={ templ.URL(fmt.Sprintf("https://t.me/share/url?url=%s/quote/%d", host, quote.ID)) }><i class="fa fa-telegram" aria-hidden="true"></i></a> ·  + <a target="_blank" href={ templ.URL(fmt.Sprintf("https://vk.com/share.php?url=%s/quote/%d", host, quote.ID)) }><i class="fa fa-vk" aria-hidden="true"></i></a> ·  + <a target="_blank" href={ templ.URL(fmt.Sprintf("https://connect.ok.ru/offer?url=%s/quote/%d", host, quote.ID)) }><i class="fa fa-odnoklassniki-square" aria-hidden="true"></i></a> </span> </footer> </article> } 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) |