an atom (RSS) feed generator written in PHP
Go to file
Jasmine Amalia 70250019f4
fix sorting issues, rewrite data as array
- the previous script sorted entries alphanumerically instead of chronologically, which was an issue for people who don't use numbered directories.
- functions have been separated from the config file for better readability and ease of use.

Signed-off-by: Jasmine Amalia <67263692+jasm1nii@users.noreply.github.com>
2023-10-20 08:34:14 +07:00
LICENSE update readme for clarity, Create LICENSE 2023-10-18 21:05:55 +07:00
README.md update readme 2023-10-18 23:04:20 +07:00
feed_generator.php fix sorting issues, rewrite data as array 2023-10-20 08:34:14 +07:00
feed_generator_functions.php fix sorting issues, rewrite data as array 2023-10-20 08:34:14 +07:00

README.md

xml-feed-generator

an RSS/atom feed generator for my personal site 🐱 tested to work with PHP version 8.2.


how it works

  1. match files in a specificied directory.
  2. load the DOM of each file.
  3. for each child of <entry> in the XML feed, output a string value from one of the following HTML elements/file properties, in order of priority:
original HTML XML output
1. class="p-name" <title>
2. the first <title> element
3. the XML feed title
1. datetime attribute of class="dt-updated" <updated>
2. datetime attribute of the first <time> element
3. file modification date, retrieved from the server
1. datetime attribute of class="dt-published" <published>
2. datetime attribute of the first <time> element
3. file creation date, retrieved from the server
1. class="p-summary" <summary>
2. <meta property="description">
1. class="e-content" <content>
2. <article>
1. /path/to/blog/entry <id> and <link rel="alternate">
  1. save all of the above into a new file named articles.xml (default name, but can be changed).

ways to use

  • configure a cron job on your web server to run automatically every now and then.

  • run the script locally on your machine.

    • you can open the file on a local server like five server for vscode or XAMPP.
    • or if PHP is installed on your system, simply open the file from the command line:
    php /path/to/feed_generator.php
    

example output

feel free to check out the resulting file that i've generated.

alternatives