-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add extra items support #126
base: master
Are you sure you want to change the base?
Conversation
* @param key | ||
* @param value | ||
*/ | ||
public addExtra = (key: string, value: ExtraItem) => this.extra[key] = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExtraItem
is just a xml-js
object. Each user needs to make sure that the object conforms to xml-js
specification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I'm not sure how I should handle these extra items in the json format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can simply ignore extra items when generating JSON? Just like extensions in atom1/rss2 format.
Hei there, Any ideas when (or if) this will be merged? |
hey @yshrsmz thanks for your time in creating this, I have forked your code and tried to understand it as much as I could. I am trying to add it to my feed as you can see in the image below, i have the attribute "extra" in the addItem function, but it doesn't seem to be working for me. I have also tried including the xml-js library and using the 'json2xml' function doesn't seem to work too. I have also simply tried with a plain string but to no avail. |
@JosephSaw could you add your example in a code snippet, not a screenshot? The following item seems to render its content correctly(I've tested with test cases in this repo). sampleFeed.addItem({
title: "Hello World",
id: "https://example.com/hello-world?id=this&that=true",
link: "https://example.com/hello-world?link=sanitized&value=2",
description: "This is an article about Hello World.",
content: "Content of my item",
date: new Date(),
extra: {
testExtra: '{"a": {"_text": " Hi "}}'
}
}) atom1
rss2
|
@yshrsmz Yup sorry, it works! Was actually using https://github.com/nuxt-community/feed-module I had to fork this and update the dependency to use the newly forked feed you created |
ebe9963
to
fd77835
Compare
a6d4a81
to
86dffd1
Compare
@jpmonette I've rebased the PR to the current master. |
86dffd1
to
c50d7a8
Compare
Has anyone already published a fork with these changes? |
@remorses if you really need it, you can use my fork directly
edit 2022/09/08: merge master branch, updated commit hash |
related #82
Hi, based on #82 I added the ability to add extra items.
I still need to add some documentation, but could you review this to make sure that the direction is right?