diff --git a/docs/configuration.md b/docs/configuration.md index d39c8b5..7bdd15f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -518,10 +518,15 @@ An array of RSS/atom feeds. The title can optionally be changed. | hide-categories | boolean | no | false | Only applicable for `detailed-list` style | | hide-description | boolean | no | false | Only applicable for `detailed-list` style | | item-link-prefix | string | no | | | +| hide-title | boolean | no | false | | +| show-domain-source | boolean | no | false | | ###### `item-link-prefix` If an RSS feed isn't returning item links with a base domain and Glance has failed to automatically detect the correct domain you can manually add a prefix to each link with this property. +###### `show-domain-source` +Useful when using FreshRSS' user queries since it shows the query name instead of the actual source + ##### `limit` The maximum number of articles to show. diff --git a/internal/assets/static/main.css b/internal/assets/static/main.css index c2a4acd..5615684 100644 --- a/internal/assets/static/main.css +++ b/internal/assets/static/main.css @@ -795,6 +795,11 @@ details[open] .summary::after { top: 0.1rem; } +.list-horizontal-text > .rss-li { + display: inline-flex; + align-items: center; +} + .header-container { margin-top: calc(var(--widget-gap) / 2); --header-height: 45px; diff --git a/internal/assets/templates/rss-detailed-list.html b/internal/assets/templates/rss-detailed-list.html index 311923d..2902eff 100644 --- a/internal/assets/templates/rss-detailed-list.html +++ b/internal/assets/templates/rss-detailed-list.html @@ -16,10 +16,17 @@
{{ .Title }} {{ if ne "" .Description }}

{{ .Description }}

diff --git a/internal/assets/templates/rss-horizontal-cards-2.html b/internal/assets/templates/rss-horizontal-cards-2.html index 0404fce..7e0ed35 100644 --- a/internal/assets/templates/rss-horizontal-cards-2.html +++ b/internal/assets/templates/rss-horizontal-cards-2.html @@ -19,7 +19,12 @@ {{ .Title }}
diff --git a/internal/assets/templates/rss-horizontal-cards.html b/internal/assets/templates/rss-horizontal-cards.html index 0f79b56..7de006e 100644 --- a/internal/assets/templates/rss-horizontal-cards.html +++ b/internal/assets/templates/rss-horizontal-cards.html @@ -19,7 +19,12 @@ {{ .Title }} diff --git a/internal/assets/templates/rss-list.html b/internal/assets/templates/rss-list.html index 0b6222a..1569bf6 100644 --- a/internal/assets/templates/rss-list.html +++ b/internal/assets/templates/rss-list.html @@ -6,10 +6,17 @@
  • {{ .Title }}
  • {{ else }} diff --git a/internal/feed/rss.go b/internal/feed/rss.go index ec6ab2e..f4b71aa 100644 --- a/internal/feed/rss.go +++ b/internal/feed/rss.go @@ -24,6 +24,8 @@ type RSSFeedItem struct { Categories []string Description string PublishedAt time.Time + SourceName string + SourceURL string } // doesn't cover all cases but works the vast majority of the time @@ -63,6 +65,8 @@ type RSSFeedRequest struct { HideDescription bool `yaml:"hide-description"` ItemLinkPrefix string `yaml:"item-link-prefix"` IsDetailed bool `yaml:"-"` + HideTitle bool `yaml:"hide-title"` + ShowSource bool `yaml:"show-domain-source"` } type RSSFeedItems []RSSFeedItem @@ -150,7 +154,18 @@ func getItemsFromRSSFeedTask(request RSSFeedRequest) ([]RSSFeedItem, error) { } } - if request.Title != "" { + if request.ShowSource { + parsedUrl, err := url.Parse(rssItem.Link) + if err != nil { + return nil, err + } + rssItem.SourceName = parsedUrl.Host + rssItem.SourceURL = parsedUrl.Scheme + "://" + parsedUrl.Host + } + + if request.HideTitle { + rssItem.ChannelName = "" + } else if request.Title != "" { rssItem.ChannelName = request.Title } else { rssItem.ChannelName = feed.Title