RSS Feed
Important

This is the documentation for v3.5.0 and lower, for documentation for v4.0.0 and higher, see https://obsidian-html.github.io/

New in v1.0.0

Introduction

The RSS feed feature creates an RSS feed out of (a selection of) your notes. You can find our RSS feed by clicking the feed button in the topright of the screen.

This feed can be added to an RSS reader. One that I like, and use to test this feature is Smart-RSS.

Configuration

Introduction

The default configuration is shown below.

    rss:
      enabled: False
      host_root: 'https://localhost:8000/'
      styling: 
        show_icon: True
      channel: 
        title: 'Notes'
        website_link: '<https://your website.com>'
        description: '<your description>'
        language_code: 'en-us'
        managing_editor: 'n/a'
        web_master: 'n/a'
      items:
        selector: 
          match_keys: []
          exclude_keys: []
          include_subfolders: []
          exclude_subfolders: ['.git','obs.html']
          exclude_files: ['not_created.html', 'index.html']
        description:
          selectors:
            - ['yaml','rss:description']
            - ['first-paragraphs', 2, '<br/><br/>']
            - ['first-header', 1]
        title: 
          selectors: 
            - ['yaml','rss:title']
            - ['first-header', 1]
            - ['path', ['parent',1], '/ ', ['stem']]
        publish_date: 
          selectors: 
            - ['yaml','rss:publish_date']
            - ['yaml_strip','tags',['date/']]
          iso_formatted: True
          format_string: ''

You can find the RSS config used by this website here (search on rss): https://github.com/obsidian-html/obsidian-html.github.io/blob/main/__src/config.yml

Note that:

There are a couple of values that you have to fill in yourself if you want to enable this feature, i.e.:

The following values are optional, but recommended:

You might also want to look into Match keys and include_subfolders for your first configuration settings.

Also make sure that the notes that you include have a publish date set in the frontmatter yaml. E.g.:

---
# Will be matched first
rss:
  publish_date: 2022-03-04

# Matched second, if first is absent
# I have this one in my template, so it exists everywhere
tags:
 - date/2022-03-04

Top level configuration

Enabled

Allowed values: True, False
This setting turns on/off the feature entirely

Host Root

Allowed values: any string
This is used to build the links to your notes. Should be your website address + possible subfolder. In our case: https://obsidian-html.github.io/

Note: we've compiled our site twice, once to https://obsidian-html.github.io/index_from_tags/ in that case, that url is the host_root.

Styling configuration

show_icon

Allowed values: True, False
You might want to enable the RSS feed, but not show the RSS icon in the topright of the page, you can turn it off here.

Channel configuration

This section fills in the channel section of the RSS feed. You can find all the settings that are possible here: https://validator.w3.org/feed/docs/rss2.html#requiredChannelElements

Note that we only implement the values that you can find in this section, more might be added in the future. Reach out via Report Issues & Request features if you miss any values that you'd like to include in your RSS feed.

Items configuration

This section is mostly selection settings: where to find the notes that you want to include, what to include/exclude them on, and how to determine the title, description, and publish date.

Selector

match_keys: [['yaml','tags',['type/news']]]
exclude_keys: []
include_subfolders: []
exclude_subfolders: ['.git', 'obs.html']
exclude_files: ['not_created.html', 'index.html']

Match keys

This value accepts lists of Selector functions

This setting allows you to only include notes that have a certain key in the frontmatter yaml.

# will select any notes that have "news: " in the frontmatter
match_keys: [['yaml','news',['']]]

# will select any notes that have any tag that starts with 'news/'
match_keys: [['yaml','tags',['news/']]]

exclude_keys

This value accepts lists of Selector functions

include_subfolders

exclude_subfolders

exclude_files

Description/Title

selectors

Publish_date

Selectors

iso_formatted

Whether the string that is selected is iso formatted. This information is used to parse the date into a dateobject, in order to get to the correct RSS date string.

format_string

Format string to be used to parse publish date string into date object if iso_formatted: False.

You can find how to build a datestring that matches your date here: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

Example using datestring for iso formatted date (normally you'd just use iso_formatted: true for this):

publish_date: 
  selectors: 
    - ['yaml','rss:publish_date']
    - ['yaml_strip','tags',['date/']]
  iso_formatted: False
  format_string: '%Y-%m-%d'

Selector functions

Some configuration items can be set using a selector.

# passing one selector 
selectors: [['selector1', 'arg1']]

# passing two selectors
selectors: [['selector1', 'arg1'], ['selector2', 'arg2']]

# same as above, but using expanded notation
selectors:
  - ['selector1', 'arg1']
  - ['selector2', 'arg2']

# passing no selectors (where applicable)
selectors: []

# wrong, passing selector without surrounding list
# will cause an error
selectors: ['selector1', 'arg1']

The fact that we always pass in a list allows us to define fallbacks, e.g.:

yaml

This selector allows us to match items on the presence of either a key, or a list value under a key. It also allows us to set a string value for e.g. the description or title, based on the value of a key (or a list item under a key).

# select notes that have the rss_desc key in the yaml frontmatter
# return the value of the key
['yaml', 'rss_desc']

# select notes that have a list element in the list under the key tags
# that starts with 'type/news', return the list element
['yaml', 'tags', 'type/news']

Some pointers:

Tree navigation

It's possible to select a key several levels down by using : as a delimiter.

Let's say you have this frontmatter:

---
rss:
  title: 'My custom title for this note'
---

then the yaml selector for this looks like this:

['yaml', 'rss:title']

yaml_strip

If you want to get the string value of a list item, for example the tag date/<date>, given:

tags:
  - date/2022-01-24

Then you'd want to strip the given prefix, to only get back the "2022-01-24".

This can be done by renaming the selector function from yaml to yaml_strip. The function will work the same as described in this section, the only change is that it will strip the prefix off of matched list values.

['yaml_strip', 'tags', ['date/']]

first-paragraphs

Parses the html, finds all paragraph elements, and then returns a string that is the innerHtml of the first paragraph, plus how many extra are selected.

# return the innerHtml of the first and the second paragraph on the page,
# as a string, separated by two line breaks
selector: ['first-paragraphs', 2, '<br/><br/>']

If no paragraphs are present then an empty string is returned, if less paragraphs are present than configured, it will combine all the paragraphs up until that point and return that.

first-header

# Get the first H1 header, and return the inner html
selector: ['first-header', 1]