Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

[plugin-rss-feed] Permalinks don't match posts' routes. #1257

Open
jcayzac opened this issue Jul 1, 2018 · 5 comments
Open

[plugin-rss-feed] Permalinks don't match posts' routes. #1257

jcayzac opened this issue Jul 1, 2018 · 5 comments
Labels

Comments

@jcayzac
Copy link

jcayzac commented Jul 1, 2018

My permalinks don't match the routes I've defined (the rest works fine, only the RSS feed is affected).

phenomic.config.js

module.exports = {
  content: {
    pages: { root: 'content', globs: ['*.md'] },
    posts: { root: 'content/posts', globs: ['**/*.md'] },
  },
  plugins: [
    ['@phenomic/plugin-rss-feed', { feeds: { query: { path: 'posts', limit: 20 } } }
  ]
}

Routes

Link to a blog post is e.g. /first-post (without any trailing slash or any other path component).

<Router history={browserHistory}>
  <Route path="/about" component={Page} />
  <Route path="/" component={Page} />
  <Route path="/404.html" component={PageError} />

  <Route path="/p:after" component={PageBlog} />
  <Route path="/*" component={PageBlogPost} />
</Router>

Permalinks in the generated feed

The generated RSS link for the blog post mentioned above is /posts/first-post/ (instead of /first-post).

<item>
  <title>
    <![CDATA[ This is a first post ]]>
  </title>
  <link>http://localhost:5000/posts/first-post/</link>
  <guid isPermaLink="true">http://localhost:5000/posts/first-post/</guid>
  <pubDate>Sun, 01 Jan 2017 00:00:00 GMT</pubDate>
</item>

I think it mistakenly uses the query domain instead of the route 🤔

@jcayzac
Copy link
Author

jcayzac commented Jul 1, 2018

It looks like the /<query.path>/<id>/ route is hard-coded at https://github.com/phenomic/phenomic/blob/master/packages/plugin-rss-feed/src/index.js#L63-L67

@jcayzac
Copy link
Author

jcayzac commented Jul 1, 2018

I tried specifying the feeds.<my feed url>.map option, which would allow me to override this behavior, but neither a function nor a copy of defaultMap works ーI get an unhandled rejected promise error 😢

EDIT: feeds fail only on development server. If I build the static site, they're generated correctly (and my custom map works). I had to fork the rss plugin just to get rid of the hardcoded routes, tho…
https://github.com/jcayzac/b/blob/master/phenomic.config.js#L44
https://github.com/jcayzac/b/blob/master/Rss.js#L39-L43

@MoOx
Copy link
Owner

MoOx commented Jul 27, 2018

We should definitely work on that. Contribution welcome. Maybe I fixed the situation on master branch already for dev server...

@MoOx MoOx added the bug label Oct 18, 2018
@MoOx
Copy link
Owner

MoOx commented Nov 26, 2018

rr3 won't be supported in phenomic revamp. A new solution will show up. This problem will have to be handled differently.

@MoOx MoOx closed this as completed Nov 26, 2018
@MoOx
Copy link
Owner

MoOx commented Nov 26, 2018

Reopening as it's still a good reminder

@MoOx MoOx reopened this Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants