nuxt-community / feed-module

Everyone deserves RSS, ATOM and JSON feeds!
MIT License
226 stars 36 forks source link

Unable to generate Feed Item content from SSR generated static page #56

Closed 8 closed 5 years ago

8 commented 5 years ago

Hi,

First: Thank you for the module!

What works: I am using yarn generate to build a static site and was able to get a basic feed xml to be generated when calling yarn generate, adding items to the feed also works.

My Problem: I am unable to figure out how I am supposed to fill the 'content' property of each item in the feed. I simply want to fill the atom feed with the contents of server side rendered pages, nothing special - but I can't figure out how I can do that.

The examples that I found only call some external APIs and use that result as the content. Well - in theory - I could spin up a second instance, e.g. start nuxt in dev mode so that an http request is served while generate runs (if the dev server wouldn't crash when yarn generate is running) but that's pretty hacky of course because the content could be out of sync, the ports could change, etc. But this sound wacky for this pretty basic use case.

My Expectation: I guess that there is a simple function in this module for this default use case that I totally overlooked, but I can't find it. :-? Can somebody point me in the right direction? Thanks!

Take care, Martin

8 commented 5 years ago

Hi, after reading the source code of this module and tinkering with it I came to the conclusion that nuxt's feed-module does not support that scenario.

I've solved my problem by reading up on nuxt.js modules and I wrote a custom module that solves my problem by listening to both to both the generate:routeCreated and generate:done event so that I can capture the generated routes and files and as soon as they are done, I call node's feed module myself and generate an atom and an rss feed in my dist folder.

Take care, Martin

manniL commented 4 years ago

Hey Martin,

sorry for the delayed answer but yes, you are totally right. Extracting the content from the current pages is not something that is supported right now, however I think it'd be a great addition for that module.

Would you consider creating a PR with the changes you made?

larry-cohen commented 2 years ago

Hi @8 , any chance you could share what you did there? Unless there is a more up-to-date way to do this?