Browse Source

Telegram: replace feed HTML link with a button to avoid page preview issues

Frédéric Guillot 2 years ago
parent
commit
39d752ca85
1 changed files with 8 additions and 8 deletions
  1. 8 8
      internal/integration/telegrambot/telegrambot.go

+ 8 - 8
internal/integration/telegrambot/telegrambot.go

@@ -10,11 +10,8 @@ import (
 )
 
 func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool, disableButtons bool) error {
-	textTemplate := `<b><a href=%q>%s</a></b> - <a href=%q>%s</a>`
 	formattedText := fmt.Sprintf(
-		textTemplate,
-		feed.SiteURL,
-		feed.Title,
+		`<a href=%q>%s</a>`,
 		entry.URL,
 		entry.Title,
 	)
@@ -34,12 +31,15 @@ func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, to
 	if !disableButtons {
 		var markupRow []*InlineKeyboardButton
 
-		minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL}
-		markupRow = append(markupRow, &minifluxURLButton)
+		websiteURLButton := InlineKeyboardButton{Text: "Go to website", URL: feed.SiteURL}
+		markupRow = append(markupRow, &websiteURLButton)
+
+		articleURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL}
+		markupRow = append(markupRow, &articleURLButton)
 
 		if entry.CommentsURL != "" {
-			commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL}
-			markupRow = append(markupRow, &commentButton)
+			commentURLButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL}
+			markupRow = append(markupRow, &commentURLButton)
 		}
 
 		message.ReplyMarkup = &InlineKeyboard{}