05-27-2019, 07:01 PM | #1 |
Member
Posts: 22
Karma: 10
Join Date: Nov 2014
Device: none
|
Author name in "dc:creator" tag ignored
I am trying to build an EPUB or MOBI book from the RSS feed of Motif Magazine. This should be fairly simple, and it mostly works, but the name of the author is ignored. The web site uses WordPress and has both the standard built-in feed and a custom feed generated by a plug-in:
http://motifri.com/feed (built-in) http://motifri.com/?call_custom_simple_rss=1 (plug-in) The web site is freely accessible to the public, so anyone is welcome to use the RSS feeds. I have administrative control over the web server, but want to avoid customization unless necessary. Here's an example "item" from the plug-in RSS feed: Code:
<item> <title>No Simple Answers in Counter-Productions’ Gidion’s Knot</title> <link>http://motifri.com/no-simple-answers-in-counter-productions-gidions-knot/</link> <pubDate>Thu, 23 May 2019 21:31:49 -0400</pubDate> <dc:creator>Terry Shea</dc:creator> <dc:identifier>75062</dc:identifier> <dc:modified>2019-05-23 21:33:00</dc:modified> <dc:created unix="1558647109">2019-05-23 21:31:49</dc:created> <guid isPermaLink="true">http://motifri.com/no-simple-answers-in-counter-productions-gidions-knot/</guid> <category>11</category> <description></description> <content:encoded>* * *</content:encoded> <enclosure url="http://www.motifri.com/wp-content/uploads/2019/05/GIDION_-150x150.jpg"/> <media:content url="http://www.motifri.com/wp-content/uploads/2019/05/GIDION_-150x150.jpg" height="150" width="150"/> <dc:dataset> <_edit_lock>1558661502:40</_edit_lock> <_edit_last>40</_edit_last> <_thumbnail_id>75063</_thumbnail_id> <post_parent>0</post_parent> <menu_order>0</menu_order> </dc:dataset> </item> I don't even care about a fancy by-line format, although that would be nice; I just want the name of the author to appear in the article. |
05-27-2019, 10:21 PM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You want feed metadata to appear in the article? There is no easy way to accomplish that, you would need to override parse_feeds() in your recipe to store a mapping of article url to author name, then implement preprocess_raw_html() in your recipe to use that mapping to insert the author name into the article HTML
|
Advert | |
|
05-28-2019, 02:09 AM | #3 |
Member
Posts: 22
Karma: 10
Join Date: Nov 2014
Device: none
|
When you put it that way, I concluded that the correct solution was to modify the server code in the "feed-rss2.php" file:
Code:
<?php $content = get_the_content_feed('rss2'); ?>
<?php if ( strlen( $content ) > 0 ) : ?>
/* Insert author name into content -- 2019-05-28 */
<?php $content = "<p><b>By " . get_the_author() . "</b></p>" . $content; ?>
<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
<?php else : ?>
<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
<?php endif; ?>
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
The element type "p" must be terminated by the matching end-tag "</p>". | uieluck | ePub | 10 | 02-12-2013 07:04 PM |
remove the "author tag" | persiomenezes | Library Management | 2 | 10-23-2011 09:18 PM |
meta tag "ePub creator" | ffarr | Sigil | 7 | 11-26-2010 12:20 AM |
Cannot get author to "stick" with Book Designer or Mobipocket Creator | zipzip | Workshop | 12 | 03-07-2009 09:38 AM |
BUG: GUI View button not working if Author tag contains "ë" | ShellShock | Calibre | 1 | 11-15-2008 01:21 PM |