diff --git a/docs/configuration.md b/docs/configuration.md
index 9c097e76..1cbeac5d 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -746,6 +746,8 @@ Example:
| preserve-order | bool | no | false |
| single-line-titles | boolean | no | false |
| collapse-after | integer | no | 5 |
+| hide-channel-name | boolean | no | false |
+| hide-link-host | boolean | no | false |
##### `limit`
The maximum number of articles to show.
@@ -794,6 +796,12 @@ Used to modify the height of cards when using the `horizontal-cards-2` style. Th
##### `feeds`
An array of RSS/atom feeds. The title can optionally be changed.
+##### `hide-channel-name`
+Used to hide the channel name from the feed. The default value is `false`.
+
+##### `hide-link-host`
+Used to hide the hostname of the link from the feed. The default value is `false`.
+
###### Properties for each feed
| Name | Type | Required | Default | Notes |
| ---- | ---- | -------- | ------- | ----- |
diff --git a/internal/glance/templates/rss-detailed-list.html b/internal/glance/templates/rss-detailed-list.html
index 311923da..a16d30e4 100644
--- a/internal/glance/templates/rss-detailed-list.html
+++ b/internal/glance/templates/rss-detailed-list.html
@@ -17,9 +17,14 @@
{{ .Title }}
+ {{ if not .HideLinkHost }}
+ - {{ .LinkHost }}
+ {{ end }}
+ {{ if not .HideChannelName }}
-
{{ .ChannelName }}
+ {{ end }}
{{ if ne "" .Description }}
diff --git a/internal/glance/templates/rss-horizontal-cards-2.html b/internal/glance/templates/rss-horizontal-cards-2.html
index 496e56ab..cf31ec93 100644
--- a/internal/glance/templates/rss-horizontal-cards-2.html
+++ b/internal/glance/templates/rss-horizontal-cards-2.html
@@ -19,7 +19,12 @@
{{ .Title }}
+ {{ if not .HideLinkHost }}
+ - {{ .LinkHost }}
+ {{ end }}
+ {{ if not .HideChannelName }}
- {{ .ChannelName }}
+ {{ end }}
diff --git a/internal/glance/templates/rss-horizontal-cards.html b/internal/glance/templates/rss-horizontal-cards.html
index d8eef927..8b3612e4 100644
--- a/internal/glance/templates/rss-horizontal-cards.html
+++ b/internal/glance/templates/rss-horizontal-cards.html
@@ -19,7 +19,13 @@
{{ .Title }}
+ {{ if not .HideLinkHost }}
+ - {{ .LinkHost }}
+ {{ end }}
+ {{ if not .HideChannelName }}
- {{ .ChannelName }}
+ {{ end }}
+
diff --git a/internal/glance/templates/rss-list.html b/internal/glance/templates/rss-list.html
index c14eb609..22d3316d 100644
--- a/internal/glance/templates/rss-list.html
+++ b/internal/glance/templates/rss-list.html
@@ -7,9 +7,14 @@
{{ .Title }}
+ {{ if not .HideLinkHost }}
+ - {{ .LinkHost }}
+ {{ end }}
+ {{ if not .HideChannelName }}
-
{{ .ChannelName }}
+ {{ end }}
{{ else }}
diff --git a/internal/glance/widget-rss.go b/internal/glance/widget-rss.go
index fe17b2fb..833f8fc1 100644
--- a/internal/glance/widget-rss.go
+++ b/internal/glance/widget-rss.go
@@ -38,6 +38,8 @@ type rssWidget struct {
CollapseAfter int `yaml:"collapse-after"`
SingleLineTitles bool `yaml:"single-line-titles"`
PreserveOrder bool `yaml:"preserve-order"`
+ HideChannelName bool `yaml:"hide-channel-name"`
+ HideLinkHost bool `yaml:"hide-link-host"`
Items rssFeedItemList `yaml:"-"`
NoItemsMessage string `yaml:"-"`
@@ -118,14 +120,17 @@ type cachedRSSFeed struct {
}
type rssFeedItem struct {
- ChannelName string
- ChannelURL string
- Title string
- Link string
- ImageURL string
- Categories []string
- Description string
- PublishedAt time.Time
+ ChannelName string
+ HideChannelName bool
+ HideLinkHost bool
+ ChannelURL string
+ Title string
+ Link string
+ LinkHost string
+ ImageURL string
+ Categories []string
+ Description string
+ PublishedAt time.Time
}
type rssFeedRequest struct {
@@ -133,6 +138,7 @@ type rssFeedRequest struct {
Title string `yaml:"title"`
HideCategories bool `yaml:"hide-categories"`
HideDescription bool `yaml:"hide-description"`
+ HideChannel bool `yaml:"hide-channel"`
Limit int `yaml:"limit"`
ItemLinkPrefix string `yaml:"item-link-prefix"`
Headers map[string]string `yaml:"headers"`
@@ -248,12 +254,19 @@ func (widget *rssWidget) fetchItemsFromFeedTask(request rssFeedRequest) ([]rssFe
rssItem := rssFeedItem{
ChannelURL: feed.Link,
+ HideChannelName: widget.HideChannelName,
+ HideLinkHost: widget.HideLinkHost,
}
+
if request.ItemLinkPrefix != "" {
rssItem.Link = request.ItemLinkPrefix + item.Link
} else if strings.HasPrefix(item.Link, "http://") || strings.HasPrefix(item.Link, "https://") {
rssItem.Link = item.Link
+ if parsedURL, err := url.Parse(item.Link); err == nil {
+ rssItem.LinkHost = strings.TrimPrefix(parsedURL.Host, "www.")
+ }
+
} else {
parsedUrl, err := url.Parse(feed.Link)
if err != nil {