bnomei / kirby3-feed

Generate a RSS/JSON-Feed and Sitemap from a Pages-Collection.
https://forum.getkirby.com/t/kirby3-feed-rss-json-sitemap/23574
MIT License
64 stars 8 forks source link

empty line at the beginning #17

Closed strukturart closed 5 years ago

strukturart commented 5 years ago

Hello,

thank you for the plugin.

My rss-feed is not valid because at the beginning there are 2 empty lines. What must I do ?

My feed.php template:

<?php
$options = [
    'url'         => site()->url(),
    'feedurl'     => site()->url() . '/feed/',
    'title'       => 'title',
    'description' => 'text_short',
    'link'        => site()->url(),
    'urlfield'    => 'url',
    'datefield'   => 'date_event_start',
    'textfield'   => 'text_short',
    'modified'    => time(),
    'snippet'     => 'feed/rss',
];
echo page('news')->children()->visible()->flip()->limit(10)->feed($options);

https://validator.w3.org/feed/

This feed does not validate.

line 3, column 0: XML parsing error: <unknown>:3:0: XML or text declaration not at start of entity [help]

<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:content="http ...
In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.

Feeds should not be served with the "text/html" media type [help]
bnomei commented 5 years ago

i need to ask the core kirby devs how to get the mime type right – again.

bnomei commented 5 years ago

i created a refac in between the time you posted you issue and tried to enforce the mime type. can you update and check again? thanks

strukturart commented 5 years ago

I have update your plugin but the same error: https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fcantinemobile.ch%2Ffeed

Is maybe something in my template wrong ?

bnomei commented 5 years ago

@strukturart are you using a route or a template? setting up the route in config like the readme of this plugin explains is the savest way to get it working.

bnomei commented 5 years ago

@strukturart where you able to verify if this does still happen with the most current version of the plugin?

strukturart commented 5 years ago

Still the same error: https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fcantinemobile.ch%2Ffeed%2F

but I'am not sure your plugin creates the 2 first empty lines.

bnomei commented 5 years ago

can you share you template or route? you can email it to my public github email if you want.

bnomei commented 5 years ago

oh its not public. b@bnomei.com

bnomei commented 5 years ago

thanks for the config. all seems well. please verify you have the most current version. i updated this plugin a lot recently.

i added a unittest to verify there are no whitespace at start https://github.com/bnomei/kirby3-feed/commit/d126fad748f5b9e7547967a669a08ae9028b26b7

and it does not fail at that test (it fails at another since kirby does not yet have a yaml mimetype)/ https://travis-ci.com/bnomei/kirby3-feed/builds/124702532

do you use a custom feed/rss snippet? if that has whitespaces it might be that.

the only other thing i can think of is the default controller or template echoing whitespace. please make sure that <?php are the first chars in every of you php files.

strukturart commented 5 years ago

thanky you @bnomei after I deleted all other plugins it works.

bnomei commented 5 years ago

so did you actually find the culprit?

strukturart commented 5 years ago

yes my custom kirby tag: https://github.com/strukturart/getKirby-tag-table

thank you for helping!

if you are a nokia8110 user and looking for a rss-reader you can try my: rss-reader https://github.com/strukturart/rss-reader

greetings john

Am Di., 27. Aug. 2019 um 12:37 Uhr schrieb Bruno Meilick < notifications@github.com>:

so did you actually find the culprit?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bnomei/kirby3-feed/issues/17?email_source=notifications&email_token=ABIKX3LMQDVZXTZDEDC4U3DQGT7VBA5CNFSM4IMPLLJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5HJN7I#issuecomment-525244157, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIKX3OJM36U6DHAHM5KHKTQGT7VBANCNFSM4IMPLLJA .

--

John-David Deubl


Juravorstadt 29 2502 Biel/Bienne

+41 77 400 62 15 print@strukturart.com

strukturart.com

Plakat Edition: kawumba.ch http://www.kawumba.ch

newsletter http://eepurl.com/_mdg5