PDA

View Full Version : Making an RSS Feed!


PTGigi
05-31-2012, 01:50 PM
I was wondering how to make these. Then I made one. It was epic. So I'm sharing this new-found knowledge with all of you now XD

For those that don't know what an RSS Feed is, it stands for Really Simple Syndication. Really Simple. They're those little orange boxes people post on their sites nowadays. (like these: http://talesofspirits.99webs.info/images/rssicons.png http://talesofspirits.99webs.info/images/rssiconm.png) Lots of webmasters use these to allow users to keep up-to-date with new content, making this great for News posts.

Make a new file (using whatever you make your codes in). The file should be called "rssfeed.xml".

Copy and paste this:
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

<channel>
<atom:link href="http://YOURURLHERE/rssfeed.xml" rel="self" type="application/rss+xml" />

<title>SITENAME</title>
<description>SITEDESCRIPTION</description>
<link>LINKTOSITENEWSARCHIVE</link>

<item>
<title>ENTRYTITLE</title>
<description>ENTRYDESCRIPTION</description>
<link>ENTRYLINK</link>
<guid>ENTRYLINK</guid>
</item>

</channel>
</rss>The giant capital letters are what you need to change, I'll help you figure out what needs to go where. If you haven't yet, save this as "rssfeed.xml" (no quotes). If you name the file anything else, you need to find where it says "rssfeed.xml" and change that.

A quick overview of the different tags, then I'll help you customize this for your site. :3



The <?xml?> and <rss> tags are important information stuffs, this basically says that this is an xml file and this is going to be used for rss. Don't touch those.
The <channel> tag defines your feed's information, everything relating to your feed needs to be in this.
The <item> tag defines entries, this would be news posts or whatnot. Each entry needs to be in it's own <item> tag.
The <title> tag is the title of your site (for the first set of tags) or the title of the document/news post/whatever.
The <description> tag is either the description of your site (first set of tags) or the description of the document/news post/whatever.
The <link> tag links the user to where an archive where all the links are (first set, or you could link this to your home page) or the link of the specific entry.
And lastly, the <guid> tag is very similar to the <link> tag, and is not needed in the first set. How is it different? I don't quite know actually. It apparently is more important and more permanent or something. I had a website yell at me for not putting those tags in, I suggest you just do it XD



Now that we've got that out of the way, how about we customize this for yourself?

We'll start near the beginning:
<channel>
<atom:link href="http://YOURURLHERE/rssfeed.xml" rel="self" type="application/rss+xml" />YOURURLHERE should be replaced with the url of your site. If you've put the file in a folder, but sure to include that by using "/foldername/" (no quotes) where "foldername" is whatever you called that folder. This just links to where the file is located.

<title>SITENAME</title>
<description>SITEDESCRIPTION</description>
<link>LINKTOSITENEWSARCHIVE</link>This is your site information. SITENAME should be the name of your site. So if you called your site "MysidiaAdoptables", you'd put that there. SITEDESCRIPTION is a short description of your site. Something like "MysidiaAdoptables is a free adoptable script to use on your site.". And lastly, the ridiculously long LINKTOSITENEWSARCHIVE should be a link to the location where you have linked to all your News posts. So, if I was using MysidiaAdoptables as an example, I'd link to the "Mysidia Adoptables Official Announcements" section. Linking to an archive is entirely optional, you could very well just link to your home page; it's more to help the user.

<item>
<title>ENTRYTITLE</title>
<description>ENTRYDESCRIPTION</description>
<link>ENTRYLINK</link>
<guid>ENTRYLINK</guid>
</item>This is the key to your RSS Feed, this links to your entries. ENTRYTITLE should be the name of your entry, so if you added a new adoptable to your site it might read "New Adoptable!". ENTRYDESCRIPTION would describe a little more, but remember, we're linking to the news post with information about this glorious event, so just keep it simple. A description such as "A new adoptable called a Dog was discovered!". And in-order to tell the reader more about this infamous Dog, you'd give the user a link to the post. Both ENTRYLINKs should be replaced with the link to the news post. If you're using a forum, simply link to the thread.

And that's all for the coding! But what about adding more content you might say? Well, that's easy enough! Just duplicate the <item> section above and edit the information to reflect a new entry. I haven't tested this out extensively, so I don't know which order you'll need to set it in to display newer information on top.

If you need a validation of your code, paste the link to your code in this website (http://feedvalidator.org/) and it should tell you if you have any errors. If you need more help, just paste the code here and I'll take a look at it. :3

-----

Now that we've got the code working, let's give your users a link. First, you'll need an image; a text link works, but a cute little orange box is more adorable and demands you to click it. You can use images from this site, for free, without credit. (http://perishablepress.com/a-nice-collection-of-feed-icons/) Just be sure to save the images to your computer, then upload them to your own host.

Then, you just need to make an image with a link (someplace people will see, like your homepage and/or the news archive). The link should be to your XML file.

And that's all! The working example I made of this is sadly for a WIP site (non-adoptable, writing stuff) and has no entries in it so I figured it wouldn't be good to use. But you could click on this to subscribe to my Smackjeeves webcomic (http://giginuzlocke.smackjeeves.com/rss/) just to see how it works (then feel free to unsubscribe if you don't want to watch it). If you have Firefox you can view your RSS Feeds by clicking on Bookmarks>Bookmarks Toolbar>then your RSS Feeds will be listed there. Hovering over one will show recent feeds. Other browsers should work the same, but IDK.

Enjoy <3 If you have any questions feel free to ask! :3

Hall of Famer
06-01-2012, 03:31 AM
This looks great Gigi, a very interesting tutorials about RSS Id say. In fact I've never used RSS on my sites, but now I guess I may give it a try. Hopefully it will help some members here, at least for those who are already kinda familiar with programming.