78 | ```
79 |
80 | The path should be relative to your current directory. For example, if your config file is at `./config.json` and you want to output the resulting files to a directory `./output`, you would run:
81 |
82 | ```
83 | rss-to-email ./config.json ./output
84 | ```
85 |
86 | ### Configuration
87 |
88 | For an example config file, see `config.example.json`.
89 |
90 | - `accentColor`: A hex or html-safe color code.
91 | - `filename`: The base name of the output files to generate (do not include extensions).
92 | - `header`: Configuration for the header section of the email:
93 | - `banner`: (optional) An image url for the banner at the top of the email.
94 | - `link`: A link for the header image or text.
95 | - `title`: Shown if the banner is not set or as an `alt` tag on the image.
96 | - `intro`: The first line of the email. Can use HTML or plain text.
97 | - `feeds`: An array of RSS feeds you'd like to include. Only `url` is required:
98 | - `url`: The url to the RSS feed.
99 | - `title`: (optional) A custom feed title. Will use the RSS feed's embedded one by default.
100 | - `description`: (optional) A short custom feed description. Will use the RSS feed's embedded one by default.
101 | - `limit`: (optional) Truncate items greater than a given limit.
102 | - `publishedSince`: (optional) Filter out posts published before this date.
103 | - `parserOptions`: (optional) Custom RSS parser options outlined in the Node [rss-parser](https://www.npmjs.com/package/rss-parser#xml-options) documentation.
104 | - `outro`: The last line of the email. Can use HTML or plain text.
105 | - `templateUrl`: (optional) A handlebars/mjml template. For more details, see [Templates](#templates) section.
106 |
107 | ### Templates
108 | In order to compose custom emails, you can build your own [MJML templates](https://mjml.io/) with [Handlebars](). If you don't specify a template URL, the library defaults to [this file](https://raw.githubusercontent.com/portable-cto/rss-to-email/master/src/templates/default.mjml).
109 |
110 | Many of the config file's variables are exposed in the templates including:
111 |
112 | - `header`
113 | - `intro`
114 | - `outro`
115 |
116 | The `feeds` variable contains an array of all of the feeds with an array of all of the items in each. For example, the following is a basic template that will loop through all the RSS feeds and items, displaying the title and content of each:
117 |
118 | ```html
119 | {{#each feeds}}
120 |
121 |
122 |
123 | {{this.title}}
124 | {{this.description}}
125 |
126 |
127 | {{#each items}}
128 |
129 |
130 |
131 |
132 | {{this.title}}
133 |
134 | {{{this.content}}}
135 |
136 |
137 | {{/each}}
138 | {{/each}}
139 | ```
140 |
141 | You can also use any helper in the [handlebars-helpers](https://github.com/helpers/handlebars-helpers) library:
142 |
143 | ```html
144 | {{#is intro "A certain intro"}}
145 | A certain intro was used.
146 | {{/is}}
147 | ```
148 |
149 | ## Contributing
150 |
151 | All patches, fixes, and ideas welcome! Please read [contributing.md](contributing.md) for furthers details.
152 |
153 |
154 | ## License
155 |
156 | [](https://opensource.org/licenses/Apache-2.0)
157 |
158 | Copyright 2021, Hughes Domains, LLC.
159 |
--------------------------------------------------------------------------------