Skip to content

A self-hosted dashboard that puts all your feeds in one place

Add single-line-titles property to RSS widget

Svilen Markovbbda9a0ee880
diff --git a/docs/configuration.md b/docs/configuration.md
index de20b76..d39c8b5 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -472,10 +472,18 @@ Example:
| thumbnail-height | float | no | 10 |
| card-height | float | no | 27 |
| limit | integer | no | 25 |
+| single-line-titles | boolean | no | false |
| collapse-after | integer | no | 5 |
##### `style`
-Used to change the appearance of the widget. Possible values are `vertical-list` and `horizontal-cards` where the former is intended to be used within a small column and the latter a full column. Below are previews of each style.
+Used to change the appearance of the widget. Possible values are:
+
+* `vertical-list` - suitable for `full` and `small` columns
+* `detailed-list` - suitable for `full` columns
+* `horizontal-cards` - suitable for `full` columns
+* `horizontal-cards-2` - suitable for `full` columns
+
+Below is a preview of each style:
`vertical-list`
@@ -517,6 +525,9 @@ If an RSS feed isn't returning item links with a base domain and Glance has fail
##### `limit`
The maximum number of articles to show.
+##### `single-line-titles`
+When set to `true`, truncates the title of each post if it exceeds one line. Only applies when the style is set to `vertical-list`.
+
##### `collapse-after`
How many articles are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse.
diff --git a/internal/assets/static/main.css b/internal/assets/static/main.css
index eddd1e0..2b1efc2 100644
--- a/internal/assets/static/main.css
+++ b/internal/assets/static/main.css
@@ -85,12 +85,18 @@
color: var(--color-primary);
}
-.text-truncate {
+.text-truncate,
+.single-line-titles .title
+{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
+.single-line-titles .title {
+ display: block;
+}
+
.text-truncate-2-lines, .text-truncate-3-lines {
overflow: hidden;
text-overflow: ellipsis;
diff --git a/internal/assets/templates/rss-list.html b/internal/assets/templates/rss-list.html
index b0291ad..0b6222a 100644
--- a/internal/assets/templates/rss-list.html
+++ b/internal/assets/templates/rss-list.html
@@ -1,10 +1,10 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
-<ul class="list list-gap-14 collapsible-container" data-collapse-after="{{ .CollapseAfter }}">
+<ul class="list list-gap-14 collapsible-container{{ if .SingleLineTitles }} single-line-titles{{ end }}" data-collapse-after="{{ .CollapseAfter }}">
{{ range .Items }}
<li>
- <a class="size-title-dynamic color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer">{{ .Title }}</a>
+ <a class="title size-title-dynamic color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer" title="{{ .Title }}">{{ .Title }}</a>
<ul class="list-horizontal-text flex-nowrap">
<li {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
<li class="min-width-0">
diff --git a/internal/widget/rss.go b/internal/widget/rss.go
index 72b6ca6..282b150 100644
--- a/internal/widget/rss.go
+++ b/internal/widget/rss.go
@@ -10,15 +10,16 @@ import (
)
type RSS struct {
- widgetBase `yaml:",inline"`
- FeedRequests []feed.RSSFeedRequest `yaml:"feeds"`
- Style string `yaml:"style"`
- ThumbnailHeight float64 `yaml:"thumbnail-height"`
- CardHeight float64 `yaml:"card-height"`
- Items feed.RSSFeedItems `yaml:"-"`
- Limit int `yaml:"limit"`
- CollapseAfter int `yaml:"collapse-after"`
- NoItemsMessage string `yaml:"-"`
+ widgetBase `yaml:",inline"`
+ FeedRequests []feed.RSSFeedRequest `yaml:"feeds"`
+ Style string `yaml:"style"`
+ ThumbnailHeight float64 `yaml:"thumbnail-height"`
+ CardHeight float64 `yaml:"card-height"`
+ Items feed.RSSFeedItems `yaml:"-"`
+ Limit int `yaml:"limit"`
+ CollapseAfter int `yaml:"collapse-after"`
+ SingleLineTitles bool `yaml:"single-line-titles"`
+ NoItemsMessage string `yaml:"-"`
}
func (widget *RSS) Initialize() error {