Customize RSS Feed

Hi all
1- I want to show articles’ download link in rss feed, what should I do?
2- Is it possible to create another rss feed for archived articles? I mean with this rss users can watch our archives and then by clicking in each date see articles of that issue.

Regards
Amir

Hi @Amir_Darejeh,

The plugin that implements web feed for issues is the WebFeed one, inside the generic folder. You would need to customize the WebFeedGatewayPlugin.inc.php file, inside the fetch method, assigning the article file object to the template manager so you could use it in the templates/rss.tpl, templates/rss2.tpl and templates/atom.tpl to build the url to download the file.

It’s not that hard to implement, but you need some programming skills.

The second question would require even more knowledge to implement, it’s not a trivial change. But basically you could use the WebFeed plugin as a base and create another one, so users could choose which one they wanted, or you could just extend the WebFeed plugin to implement archives also.

Cheers.

Hi Bruno
Sorry for late answer, I’m working on it but still can’t get any result.
Could you help me to add other meta info to RSS? I need to show paper’s pic and pdf link.

Regards
Amir

Hi @Amir_Darejeh,

Sure, I can help. Can you post what you’ve done so far? Are we talking about OJS or OCS?

Thanks,
Bruno

Thanks Bruno
I’m working on OJS and following codes are my changes in plugins / generic / webFeed / templates / atom.tpl

		{if $article->getLocalizedAbstract()}
			<summary type="html" xml:base="{url page="article" op="view" path=$article->getBestArticleId($currentJournal)}">{$article->getLocalizedAbstract()|strip|escape:"html"}xxx{$article->getFileName()|strip|escape:"html"}</summary>
		{/if}

But I only see xxxArray !!
What should I do >?

Regards
Amir

Hi Bruno
Are you there?

Hi @Amir_Darejeh,

Regarding the PDF link, you can try something like this in plugins/generic/webFeed/templates/rss2.tpl :

{foreach from=$article->getGalleys() item=galley name=galleyList}
<enclosure url="{url page=“article” op=“view” path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" type=“application/pdf”></enclosure>
{/foreach}

This is just an idea that will output article galleys links and names. Dont’ know anything about RSS so it may be not validated. Anyway, as you can see type= is set to application/pdf. Feel free to modify it as you need. Hope it helps.

Regards.

Hi @andymp
Thanks for your help, But it doesn’t work! :frowning:
Do you have any other solution?

Regards
Amir

Hi @Amir_Darejeh,

Sorry the long time to reply, having problems accessing internet locally here.

To get the article file name, you should try the getLocalizedFileName method, instead of the one you’re using.

Cheers,
Bruno

Hi Bruno
Thank you, Bu it doesn’t work!
When I use getLocalizedFileName I see only an image name at the end of abstract!
Do have any other solution?!

Regards
Amir

Sorry @Amir_Darejeh,

I misunderstood what you were trying to get. To present the download links for the article galleys, check the templates/article/article.tpl file, starting at line 77. Basically you get the galleys from the article object, then you build the download url using both the article and galley id.

Cheers,
Bruno

Hi @beghelli
Thanks, But My question is about customizing RSS Feed.
I want to add article’s image and pdf link to RSS feed.

Regards
Amir

@Amir_Darejeh,

I just pointed out where in the code you have something like you need. Then you can look at it, learn how to do it and implement yourself into the RSS Feed.

Regards,
Bruno

It’s OK.
If you can conduct me to which codes that I must to use, or where can I find codes that I need; I’ll try to make it by myself.

Regards
Amir

@Amir_Darejeh,

I just pointed out to you some code to get the article galleys and to build the download url. But It will be hard to understand that if you have no coding skills, unfortunately. I also can’t code that to you, that’s an amount of time that I can’t spend on the support activity. What I can do is to help you while you’re doing the work and coming back with doubts and questions.

Regards,
Bruno

Thanks Bruno, You right.
I was a programmer so still I have some programming skill.
You said > you should try the getLocalizedFileName method, instead of the one you’re using.
I putted your method in my code instead of getFileName(), But the result is an image name!

How can I get pdf name and link?

Regards
Amir

Check my previous message: Customize RSS Feed - #11 by beghelli

ok Thank you,
I’ll try it and inform you

Regards
Amir

Hi again
I did it with this code

<![CDATA[
<img src="http://www.gmj.ir/gmj/public/journals/1/{$article->getLocalizedFileName()|escape}"/>
        ]]>

but how can I replace http://www.gmj.ir/gmj/public/journals/1/ with a standard OJS address like

{url page="article" op="view" path=$article->getBestArticleId($currentJournal)}</link>
<link>{url page="article" op="view" path=$article->getBestArticleId($currentJournal)}

regards
Amir

The smarty {url} function is what creates the standard OJS address. The parameters “page”, “op”, and “path” correspond to the URL components after the base URL.

For example, if

generates
www . gmj . ir /gmj/public/journals/1/ article / view / $article_id
then

will generate
www . gmj . ir /gmj/public/journals/1/ article / view / $article_id / $galley_id