Autoupdate feedr?

57 views
Skip to first unread message

Mads Høbye

unread,
Jun 9, 2012, 8:29:25 AM6/9/12
to doc...@googlegroups.com
Hey 

I have now spend the last couple of days building my website in docpad. It is everything I could ever wish for. I am so happy. I only have one problem:

I have implemented feedr with a twitter rss feed. This is working great, but as far as I understand it will not update automatically since the pages are static? My ideal scenario is to have the docpad autogenerate the frontpage page once every 10 minutes. I have been trying to look for different ways to solve this without luck. Alternatively I can make the page dynamic (which means, as far as I understand, that it will be generated at every request). This is overkill, but good enough. Except I get an error when I try to use @feedr.feeds or @documents. I am writing here because I am not sure it is a bug or me doing something wrong?

As a side comment: would it be possible to make a dynamic: [insert minutes here]. Then if the requested page is older than the minutes it will be regenerated. This would enable it to be dynamic and still handle loads of requests.

Here are the details:

Code (index.html.eco - bootstrap skeleton):


<h1 style="margin-bottom:10px;">Twitter: What people say about the projects I am involved in</h1>

<div class="row" style="text-align:left;">
<% for m in @feedr.feeds.twit23.entry: %>
<div class="span2" style="height:200px;">
<a style="font-weight:bold;" target="_blank" href="<%=m.link[0]['@'].href%>" title="View on Twitter">
<%-m.author['name']%>
</a><br/>
<%-m.content['#']%>
</div>
<% end %>
</div>
 
Error: 

In browser: Cannot read property 'feeds' of undefined
Terminal:

warning: Something went wrong while rendering: index.html.eco
error: An error occured: Cannot read property 'feeds' of undefined TypeError: Cannot read property 'feeds' of undefined
    at Object.<anonymous> (eval at <anonymous> (/Users/madshobye/Dropbox/nodeLive/hobyedk_docpad5/node_modules/docpad-plugin-eco/node_modules/eco/lib/compiler.js:19:12))
    at Object.<anonymous> (eval at <anonymous> (/Users/madshobye/Dropbox/nodeLive/hobyedk_docpad5/node_modules/docpad-plugin-eco/node_modules/eco/lib/compiler.js:19:12))
    at eval at <anonymous> (/Users/madshobye/Dropbox/nodeLive/hobyedk_docpad5/node_modules/docpad-plugin-eco/node_modules/eco/lib/compiler.js:19:12)
    at Function.render (/Users/madshobye/Dropbox/nodeLive/hobyedk_docpad5/node_modules/docpad-plugin-eco/node_modules/eco/lib/index.js:26:24)
    at EcoPlugin.render (/Users/madshobye/Dropbox/nodeLive/hobyedk_docpad5/node_modules/docpad-plugin-eco/eco.plugin.coffee:24:30)
    at /usr/local/lib/node_modules/docpad/lib/plugin.js:43:34
    at /usr/local/lib/node_modules/docpad/node_modules/bal-util/lib/events.js:274:18
    at _Class.nextTask (/usr/local/lib/node_modules/docpad/node_modules/bal-util/lib/flow.js:117:11)
    at _Class.complete (/usr/local/lib/node_modules/docpad/node_modules/bal-util/lib/flow.js:154:20)
    at /usr/local/lib/node_modules/docpad/node_modules/bal-util/lib/flow.js:166:33

Hope somebody could answer this.

m

Benjamin Lupton

unread,
Jun 10, 2012, 8:58:14 AM6/10/12
to
Thanks for the kind words :) It's definitely possible.

I currently accomplish this on my own website by doing the following in my server.coffee file: https://github.com/balupton/balupton.docpad/blob/f925ca5a914c94e37aa52b00f807fce9155097d2/server.coffee#L80-86 - to run the server.coffee file, you'll run the command `coffee server.coffee` - running `docpad run` does not run the server.coffee file.

Your idea of being able to specify a regenerateAfter field for documents is a really good one. Version 6 will have the infrastructure to do this, so I'll see what I can do to get it into a v6.x release.

It would also be a bug that dynamic and feedr doesn't work, I'll look into it.

Thanks mate :) Let me know if that server.coffee modification works out!

Mads Høbye

unread,
Jun 10, 2012, 8:22:19 AM6/10/12
to doc...@googlegroups.com
Okay thats what it does. It is already in my server file. I will look out for it and see whether it does the trick or not.

On Sun, Jun 10, 2012 at 4:30 AM, Benjamin Lupton <balu...@gmail.com> wrote:
Thanks for the kind words :) It's definitely possible.

I currently accomplish this on my own website by doing the following in my server.coffee file: https://github.com/balupton/balupton.docpad/blob/f925ca5a914c94e37aa52b00f807fce9155097d2/server.coffee#L80-86

Your idea of being able to specify a regenerateAfter field for documents is a really good one. Version 6 will have the infrastructure to do this, so I'll see what I can do to get it into a v6.x release.

It would also be a bug that dynamic and feedr doesn't work, I'll look into it.

Thanks mate :) Let me know if that server.coffee modification works out!

--
You received this message because you are subscribed to the Google Groups "DocPad" group.
To view this discussion on the web visit https://groups.google.com/d/msg/docpad/-/_-UBypQtZ6IJ.

To post to this group, send email to doc...@googlegroups.com.
To unsubscribe from this group, send email to docpad+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/docpad?hl=en.

Reply all
Reply to author
Forward
0 new messages