mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
added new config option showTitleAsUrl
to newsfeed module
This commit is contained in:
parent
d181365620
commit
c4e7e42cdd
@ -14,6 +14,7 @@ _This release is scheduled to be released on 2022-04-01._
|
|||||||
- Added a config option under the weather module, absoluteDates, providing an option to format weather forecast date output with either absolute or relative dates.
|
- Added a config option under the weather module, absoluteDates, providing an option to format weather forecast date output with either absolute or relative dates.
|
||||||
- Added test for new weather forecast absoluteDates porperty.
|
- Added test for new weather forecast absoluteDates porperty.
|
||||||
- The modules get a class hidden added/removed if they get hidden/shown
|
- The modules get a class hidden added/removed if they get hidden/shown
|
||||||
|
- Added new config option `showTitleAsUrl` to newsfeed module. If set, the diplayed title is a link to the article which is useful when running in a browser and you want to read this article.
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ Module.register("newsfeed", {
|
|||||||
broadcastNewsFeeds: true,
|
broadcastNewsFeeds: true,
|
||||||
broadcastNewsUpdates: true,
|
broadcastNewsUpdates: true,
|
||||||
showDescription: false,
|
showDescription: false,
|
||||||
|
showTitleAsUrl: false,
|
||||||
wrapTitle: true,
|
wrapTitle: true,
|
||||||
wrapDescription: true,
|
wrapDescription: true,
|
||||||
truncDescription: true,
|
truncDescription: true,
|
||||||
@ -141,6 +142,7 @@ Module.register("newsfeed", {
|
|||||||
sourceTitle: item.sourceTitle,
|
sourceTitle: item.sourceTitle,
|
||||||
publishDate: moment(new Date(item.pubdate)).fromNow(),
|
publishDate: moment(new Date(item.pubdate)).fromNow(),
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
url: item.url,
|
||||||
description: item.description,
|
description: item.description,
|
||||||
items: items
|
items: items
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,22 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro escapeTitle(title, url, dangerouslyDisableAutoEscaping=false, showTitleAsUrl=false) %}
|
||||||
|
{% if dangerouslyDisableAutoEscaping %}
|
||||||
|
{% if showTitleAsUrl %}
|
||||||
|
<a href="{{ url }}" style="text-decoration:none;color:#ffffff" target="_blank">{{ title | safe }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ title | safe}}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if showTitleAsUrl %}
|
||||||
|
<a href="{{ url }}" style="text-decoration:none;color:#ffffff" target="_blank">{{ title }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ title }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% if loaded %}
|
{% if loaded %}
|
||||||
{% if config.showAsList %}
|
{% if config.showAsList %}
|
||||||
<ul class="newsfeed-list">
|
<ul class="newsfeed-list">
|
||||||
@ -22,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
||||||
{{ escapeText(item.title, config.dangerouslyDisableAutoEscaping) }}
|
{{ escapeTitle(item.title, item.url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
|
||||||
</div>
|
</div>
|
||||||
{% if config.showDescription %}
|
{% if config.showDescription %}
|
||||||
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
||||||
@ -49,7 +65,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
||||||
{{ escapeText(title, config.dangerouslyDisableAutoEscaping) }}
|
{{ escapeTitle(title, url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
|
||||||
</div>
|
</div>
|
||||||
{% if config.showDescription %}
|
{% if config.showDescription %}
|
||||||
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user