Tags to import an RSS or Atom feed
Please note: These tags are not relevant to the drag & drop editor.
Many websites have an RSS feed (or an Atom feed, a variant) connected to them. This feed contains articles that are also on the website, but in a standard format that can easily be read by computers. Laposta can read this feed and insert it into a template. This way, a newsletter can be compiled quickly without copy-pasting.
Operation
When loading the template in the editor, the feed is read and the indicated elements are shown. By default, all items present in the feed are shown. A cross appears next to each item in the editor. Clicking on this removes the item. This way, you can quickly make a selection.
This selection will be saved in subsequent steps. Reloading the template overwrites the selection; then all current items are shown again.
Start the feed with <lp-rss>.
The feed should be embedded in <lp-rss> and </lp-rss> tags. It is possible to include several feeds in the same template.
Options
lp-rss-url
This attribute indicates which feed should be loaded.
lp-rss-type
This attribute indicates the type of feed. Possible values are 'rss' or 'atom'. If this attribute is absent, it is assumed that an 'rss' feed is used.
lp-rss-maxitems
This attribute indicates the maximum number of items to be loaded. Example: if lp-rss-maxitems="5", a maximum of 5 items will be displayed.
If the attribute is absent, all present items are loaded.
lp-rss-range
This attribute allows you to specify a from/to range for the items to be displayed. The format is [number]-[number]. Example: if lp-rss-range="2-5", only items 2, 3, 4 and 5 will be shown. It is also possible to display only one item, as follows: lp-rss-range="1-1" for only the first item.
If the attribute is absent, all present items are loaded.
lp-rss-filter
You can use this attribute to specify which items may be displayed. This assumes there is a field in the feed that can contain different values; such as labels or categories. For example, if the feed contains:
<label>
<item>Pensions</item>
<item>Housing</item>
<item>Labour market</item>
</label>
and the intention is to display only the articles that deal with labour market or education, then the filter could look like this:
lp-rss-filter="label|item|labour market,education"
The format therefore is as follows: [name field]|[name sub-items]|valueA,valueB,valueC,...
Sometimes the sub-items are directly in the feed, without a parent item. The first place can then remain empty. Suppose the feed contains the following:
<category>Pensions</category>
<category>Housing</category>
<category>Labour market</category>
Then the filter becomes will look as follows:
lp-rss-filter="|category|labour market,education".
Display text with <lp-rss-content>.
The HTML code inside the <lp-rss> start and end tag will be repeated for each item in the feed. The content from the feed can be processed in that HTML code.
<lp-rss-content:[field name]>
The naming of the fields within a feed can differ. After the colon, the name of the field can be mentioned, for example: <lp-rss-content:title> for the title.
<lp-rss-content:datenl>
This is a special field that shows the date of the item in Dutch format.
Display an image with <lp-rss-image>.
A feed often contains an image per item. With <lp-rss-image> this image can be shown. There are no special attributes; the tag can be used as a normal image.
If you only need to use the location of the image, you can use:
<lp-rss-image:src>
Example
Load the feed of the newspaper Volkskrant, and for each item display the title (with a link behind it), the image and the text.
<lp-rss lp-rss-url="https://www.volkskrant.nl/voorpagina/rss.xml" lp-rss-type="rss" lp-rss-range="1-5"> <br><table border="0" cellpadding="0" cellspacing="0" width="100%"> <br><tr><br> <td align="left"><br> <a href="<lp-rss-content:link>"><lp-rss-content:title></a> <br></td> <br></tr> <br><tr><br> <td align="left"><br> <lp-rss-image width="560"><br> </td> <br></tr> <br><tr><br> <td align="left"><br> <lp-rss-content:description><br> </td> <br></tr> <br></table> <br></lp-rss>