2.14.0 • Published 6 years ago

docpad-plugin-feedr v2.14.0

Weekly downloads
45
License
MIT
Repository
github
Last release
6 years ago

Feedr Plugin for DocPad

This plugin is able to pull in remote json and xml feeds, convert them to JSON data, and expose them to @feedr.feeds[feedName] for your templates, via the Feedr module.

Install

docpad install feedr

Usage

Setup

First we have to tell Feedr which feeds it should retrieve, you can do this by adding the following to your website's docpad configuration file:

plugins:
	feedr:
		feeds:
			twitter:
				url: "https://api.twitter.com/1/statuses/user_timeline.json?screen_name=balupton&count=20&include_entities=true&include_rts=true"

			someOtherFeedName:
				url: "someOtherFeedUrl"

Feedr can also clean up responses like "key": {"_content": "the actual value"} (as used on Flickr) to the cleaner "key": 'the actual value". To enable this set clean to true inside your feed configuration like so:

flickrUser:
	url: "http://api.flickr.com/services/rest/?method=flickr.people.getInfo&api_key=#{FLICKR_API_KEY}&user_id=#{FLICKR_USER_ID}&format=json&nojsoncallback=1"
	clean: true

Rendering

Then inside your templates, we would do something like the following to render the items:

  • Using Eco

    	``` coffeescript
    	<ul>
    		<% for tweet in @feedr.feeds.twitter: %>
    			<% continue  if tweet.in_reply_to_user_id %>
    			<li datetime="<%=tweet.created_at%>">
    				<a href="https://twitter.com/#!/<%=tweet.user.screen_name%>/status/<%=tweet.id_str%>" title="View on Twitter">
    					<%=tweet.text%>
    				</a>
    			</li>
    		<% end %>
    	</ul>
    	```
  • Using CoffeeKup

    	``` coffeescript
    	ul ->
    		for tweet in @feedr.feeds.twitter
    			continue  if tweet.in_reply_to_user_id
    			li datetime: tweet.created_at, ->
    				a href: "https://twitter.com/#!/#{tweet.user.screen_name}/status/#{tweet.id_str}", title: "View on Twitter", ->
    					tweet.text
    	```

Discover the release history by heading on over to the HISTORY.md file.

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Unless stated otherwise all works are:

and licensed under:

2.14.0

6 years ago

2.13.0

6 years ago

2.12.0

7 years ago

2.11.0

9 years ago

2.10.0

10 years ago

2.9.0

10 years ago

2.8.0

10 years ago

2.7.0

10 years ago

2.6.0

11 years ago

2.5.0

11 years ago

2.4.2

11 years ago

2.4.1

11 years ago

2.4.0

11 years ago

2.3.0

11 years ago

2.2.0

12 years ago

2.1.0

12 years ago

2.0.2

12 years ago

2.0.1

12 years ago

2.0.0

12 years ago

1.0.0

12 years ago