Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| blocks:app-note:rss-feed [2024-03-14 09:54] – [Installation] mattias | blocks:app-note:rss-feed [2024-03-14 13:10] (current) – mattias | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| This application note assumes previous experience with blocks, it exemplifies how to use a feed script to parse an RSS feed and use child replication in blocks to publish the content on a spot. | This application note assumes previous experience with blocks, it exemplifies how to use a feed script to parse an RSS feed and use child replication in blocks to publish the content on a spot. | ||
| - | [[https:// | + | [[https:// |
| ====Installation==== | ====Installation==== | ||
| - | * Make sure you have the latest script dependencies from https:// | + | * Make sure you have the latest script dependencies from https:// |
| - | * Enable the script by copy the RSS.ts and RSS.js from the script/ | + | * Enable the script by copying |
| * Restart blocks. This will enable the script and the script will write an example configuration file in scripts/ | * Restart blocks. This will enable the script and the script will write an example configuration file in scripts/ | ||
| * Rename the example file Rss.config.example.json to Rss.config.json (this file it written when the script is used) | * Rename the example file Rss.config.example.json to Rss.config.json (this file it written when the script is used) | ||
| - | * Create a task with a do statement bound the scripts | + | * Create a task with a do statement bound the scripts Script.feed.RSS.reInitialize |
| * Run the task to restart the script and use the sample settings. | * Run the task to restart the script and use the sample settings. | ||
| * Download the example block from here: {{ : | * Download the example block from here: {{ : | ||
| Line 19: | Line 19: | ||
| {{: | {{: | ||
| - | Please note, if working with feeds on spots, it is the spot that downloads any images, not the server, hence the spot must be able to access any images. | + | :!: Please note, if working with feeds on spots, it is the spot that downloads any images, not the server, hence the spot must be able to access any images. |
| Line 43: | Line 43: | ||
| ====Configure the script==== | ====Configure the script==== | ||
| ===Configuration file=== | ===Configuration file=== | ||
| - | This feedscript can use a configuration file // | + | This feedscript can use an optional |
| In the example configuration we can see an entry where a preferred image size has been indicated. This setting only works for feeds that contain what's in RSS called a < | In the example configuration we can see an entry where a preferred image size has been indicated. This setting only works for feeds that contain what's in RSS called a < | ||
| - | Use the //maxAge// to control for how long we want to show the article in the feed, and use the maxLength | + | Use the //maxAge// to control for how long we want to show the article in the feed, and use the maxLength |
| Exampel configuration: | Exampel configuration: | ||
| Line 75: | Line 75: | ||
| - | ===Configure with task=== | + | ===Configure |
| - | As an option we can configure feeds in runtime using a callable on the script as in this example: | + | Feeds can be configured |
| {{: | {{: | ||
| - | The options are basically the same but will only be added if a task has been setup to be triggered at startup | + | The options are basically the same as with the config file method, |
| - | If using task to configure feeds one may want to remove the config file. | + | If using the task to configure feeds one may want to remove the config file if present. |
| ===Reinitialize the script=== | ===Reinitialize the script=== | ||
| - | The feed script exposes a second callable that merely | + | The feed script exposes a second callable that merely |
| ====Styling==== | ====Styling==== | ||
| - | In the example block we use a CSS trick to be able to add ellipsis | + | In the example block we use a CSS trick to be able to add ellipses |
| - | The ellipsis css rule: | + | The ellipsis css rule used here: |
| < | < | ||
| .rss .multi-line-ellipsis { | .rss .multi-line-ellipsis { | ||
| Line 98: | Line 98: | ||
| } | } | ||
| </ | </ | ||
| + | |||