mirror of
https://github.com/glanceapp/glance.git
synced 2024-11-29 11:55:05 +01:00
feat: hide-title and show-domain-source for rss
This commit is contained in:
parent
d60457afaf
commit
1aa325de27
@ -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-categories | boolean | no | false | Only applicable for `detailed-list` style |
|
||||||
| hide-description | 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 | | |
|
| item-link-prefix | string | no | | |
|
||||||
|
| hide-title | boolean | no | false | |
|
||||||
|
| show-domain-source | boolean | no | false | |
|
||||||
|
|
||||||
###### `item-link-prefix`
|
###### `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.
|
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`
|
##### `limit`
|
||||||
The maximum number of articles to show.
|
The maximum number of articles to show.
|
||||||
|
|
||||||
|
@ -795,6 +795,11 @@ details[open] .summary::after {
|
|||||||
top: 0.1rem;
|
top: 0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-horizontal-text > .rss-li {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.header-container {
|
.header-container {
|
||||||
margin-top: calc(var(--widget-gap) / 2);
|
margin-top: calc(var(--widget-gap) / 2);
|
||||||
--header-height: 45px;
|
--header-height: 45px;
|
||||||
|
@ -16,10 +16,17 @@
|
|||||||
<div class="grow min-width-0">
|
<div class="grow min-width-0">
|
||||||
<a class="size-h3 color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
<a class="size-h3 color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
||||||
<ul class="list-horizontal-text flex-nowrap">
|
<ul class="list-horizontal-text flex-nowrap">
|
||||||
<li {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
<li class="rss-li" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
||||||
<li class="min-width-0">
|
{{ if .ChannelName }}
|
||||||
|
<li class="rss-li min-width-0">
|
||||||
<a class="block text-truncate" href="{{ .ChannelURL }}" target="_blank" rel="noreferrer">{{ .ChannelName }}</a>
|
<a class="block text-truncate" href="{{ .ChannelURL }}" target="_blank" rel="noreferrer">{{ .ChannelName }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .SourceName }}
|
||||||
|
<li class="rss-li min-width-0">
|
||||||
|
<a class="block text-truncate" href="{{ .SourceURL }}" target="_blank" rel="noreferrer">{{ .SourceName }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
{{ if ne "" .Description }}
|
{{ if ne "" .Description }}
|
||||||
<p class="rss-detailed-description text-truncate-2-lines margin-top-10">{{ .Description }}</p>
|
<p class="rss-detailed-description text-truncate-2-lines margin-top-10">{{ .Description }}</p>
|
||||||
|
@ -19,7 +19,12 @@
|
|||||||
<a href="{{ .Link }}" title="{{ .Title }}" class="block text-truncate color-primary-if-not-visited" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
<a href="{{ .Link }}" title="{{ .Title }}" class="block text-truncate color-primary-if-not-visited" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
||||||
<ul class="list-horizontal-text flex-nowrap margin-top-5">
|
<ul class="list-horizontal-text flex-nowrap margin-top-5">
|
||||||
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
||||||
|
{{ if .ChannelName }}
|
||||||
<li class="min-width-0 text-truncate">{{ .ChannelName }}</li>
|
<li class="min-width-0 text-truncate">{{ .ChannelName }}</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .SourceName }}
|
||||||
|
<li class="min-width-0 text-truncate">{{ .SourceName }}</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,12 @@
|
|||||||
<a href="{{ .Link }}" title="{{ .Title }}" class="text-truncate-3-lines color-primary-if-not-visited margin-top-10 margin-bottom-auto" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
<a href="{{ .Link }}" title="{{ .Title }}" class="text-truncate-3-lines color-primary-if-not-visited margin-top-10 margin-bottom-auto" target="_blank" rel="noreferrer">{{ .Title }}</a>
|
||||||
<ul class="list-horizontal-text flex-nowrap margin-top-7">
|
<ul class="list-horizontal-text flex-nowrap margin-top-7">
|
||||||
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
||||||
|
{{ if .ChannelName }}
|
||||||
<li class="min-width-0 text-truncate">{{ .ChannelName }}</li>
|
<li class="min-width-0 text-truncate">{{ .ChannelName }}</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .SourceName }}
|
||||||
|
<li class="min-width-0 text-truncate">{{ .SourceName }}</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,10 +6,17 @@
|
|||||||
<li>
|
<li>
|
||||||
<a class="title size-title-dynamic color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer" title="{{ .Title }}">{{ .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">
|
<ul class="list-horizontal-text flex-nowrap">
|
||||||
<li {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
<li class="rss-li" {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
|
||||||
<li class="min-width-0">
|
{{ if .ChannelName }}
|
||||||
|
<li class="rss-li min-width-0">
|
||||||
<a class="block text-truncate" href="{{ .ChannelURL }}" target="_blank" rel="noreferrer">{{ .ChannelName }}</a>
|
<a class="block text-truncate" href="{{ .ChannelURL }}" target="_blank" rel="noreferrer">{{ .ChannelName }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .SourceName }}
|
||||||
|
<li class="rss-li min-width-0">
|
||||||
|
<a class="block text-truncate" href="{{ .SourceURL }}" target="_blank" rel="noreferrer">{{ .SourceName }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
@ -24,6 +24,8 @@ type RSSFeedItem struct {
|
|||||||
Categories []string
|
Categories []string
|
||||||
Description string
|
Description string
|
||||||
PublishedAt time.Time
|
PublishedAt time.Time
|
||||||
|
SourceName string
|
||||||
|
SourceURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
// doesn't cover all cases but works the vast majority of the time
|
// 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"`
|
HideDescription bool `yaml:"hide-description"`
|
||||||
ItemLinkPrefix string `yaml:"item-link-prefix"`
|
ItemLinkPrefix string `yaml:"item-link-prefix"`
|
||||||
IsDetailed bool `yaml:"-"`
|
IsDetailed bool `yaml:"-"`
|
||||||
|
HideTitle bool `yaml:"hide-title"`
|
||||||
|
ShowSource bool `yaml:"show-domain-source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RSSFeedItems []RSSFeedItem
|
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
|
rssItem.ChannelName = request.Title
|
||||||
} else {
|
} else {
|
||||||
rssItem.ChannelName = feed.Title
|
rssItem.ChannelName = feed.Title
|
||||||
|
Loading…
Reference in New Issue
Block a user