Wednesday, August 28, 2024

A feed that combines two things

In brief

  • Use the OR operator | (or "%7C") in the feed url to filter the union of two search terms.
  • Follow the feed in a reader or use it to create a dynamic list.
Two curved shapes join to form a single pointed arrow
image: openclipart-vectors

Your blog feed is a jumble of unreadable code. Yet it is is broadly useful to people who follow your blog in a feed reader.

You can also use feeds to create lists of posts by topic.

Finally, you can tailor a feed to combine or exclude posts by topic. For example, create a single feed from the posts tagged with two or more different labels.

Either A OR B

A previous post explored tailoring a feed to show only posts that had both the label "feed" and also the label "things that changed." A and also B.

Today's report explains how to build a feed search that finds either A or B (or both). All of "feeds" plus all of "things that changed."

Image: Kismalac (public domain)
A OR B

Because I omit some of the general explanation here, you may wish to start with the first post in this series.

That report includes information about your feed and the use of search terms that I do not repeat here.

Every feed has a URL

The feed url that finds all of my posts labeled "feeds" and all of my posts labeled "things that changed" uses the or operator (|):

https://too-clever-by-half.blogspot.com/feeds/posts/default?by-date=true&q=label:feeds|label:"things that changed"

or

https://too-clever-by-half.blogspot.com/feeds/posts/default?by-date=true&q=label:feeds%7Clabel:"things that changed"

The form is similar to that of "A that is also B," except that it uses or, not and (+).

In the above urls for the feed,

  • too-clever-by-half.blogspot.com is the blog url.
  • ?by-date=true is an optional operator to specify most-recent-first.
  • &q= is the search query operator.
  • label:feeds is the label to search for.
  • | is the logical (Boolean) operator or, for the union or intersection of the two sets of posts. You can also use %7C.
  • label:"things that changed" is the second label. Note that quotes are required for label names that include spaces.

That or character, also known as the pipe, is the uppercase left-leaning slash (\) at far right on many keyboards. 

In the url, you can substitute "%7C" for |. Web browsers evaluate those as the same thing.

There is more about all of this, with more links to more explanations, in my introduction to tailored feeds.

If this is unclear, start there.

Dynamic list

Here's a dynamic list (using on the above feed): all of my "feeds" posts together with all of my "things that changed" posts.

It's "dynamic" because the list changes, automatically, as labels are applied and removed from posts.

It's lengthy because I've published many posts under each label over time.

Note that only a handful of them overlap: most feed posts do not report changes, and most changes posts are not about feeds. OR just piles them together.

Because there are more than 25 of these, I added the &max-results=150 parameter to the end of this feed. Without that, Blogger caps the feed at 25 elements.

This feed corresponds to the blog's "or" label search page. Unlike the feed, which is a code jumble, that page is readable by humans.

Related posts below.

Tailored feedsLogical ANDLogical OR
About feedsDynamic listsTailored pages

1 comment: