• Hello,

    I have installed your plugin and I have an issue.
    Everything is ok but the main sitemap.xml or sitemap-news.xml are blank. If I choose ctrl+U in chrome for view source I can find all the information from sitemap but I saw that stylesheet is pointing to another location.

    How can I change the xsl stylesheet location? I use a CDN Linker and I have put all my wp-content into the folder “cdn”.

    Wrong stylesheet
    <?xml version=”1.0″ encoding=”UTF-8″?><?xml-stylesheet type=”text/xsl” href=”/wp-content/plugins/xml-sitemap-feed/assets/sitemap.xsl?ver=5.3.3″?>

    Right styelsheet
    <?xml version=”1.0″ encoding=”UTF-8″?><?xml-stylesheet type=”text/xsl” href=”/cdn/wp-content/plugins/xml-sitemap-feed/assets/sitemap.xsl?ver=5.3.3″?>

    How can I change the path to the needed stylesheet?

    Thanks,
    ionica

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 19 total)
  • Hi ionica, the plugin uses a WordPress internal function wp_make_link_relative for the stylesheet location. Apparently this is not compatible with CDN Linker. Is there any way to exclude certain files from the CDN?

    The problem is that the XML styleheet will likely cause errors when hosted on a different domain (cdn subdomain) than the XML itself.

    Please note that the failing stylesheet will not interfere with normal sitemap indexing. The Search spiders do not need the stylesheet.

    Thread Starter i0n1ca

    (@i0n1ca)

    Hi Rolf,

    I can’t exclude only one directory. I don’t know why the function mentioned by you does not get the right wp-content DIR because it is set in wp-config file for content, plugins and themes. Other plugins are corectly setup with the path of cdn.isay.ro/wp-content/…

    Do you know any workaround that I can apply? ??
    Or should I leave it like this without stylesheet?

    Thanks,
    ionica

    Thread Starter i0n1ca

    (@i0n1ca)

    I did a workaround and copied “assets” folder from /cdn/wp-content/plugins to /wp-content folder that is empty and created folders to right path of the styelsheet /wp-content/plugins/xml-sitemap-feed/assets. Now it is working and stylesheet is loaded.

    But this has to be made everytime you update the plugin and I have to copy the assets directory from a location cdn to wp-content.

    Thread Starter i0n1ca

    (@i0n1ca)

    Now, I can see in error_log that is trying to execute file feed-sitemap-pt.php which does not exists in views folder.

    [25-Jan-2022 12:55:18 UTC] PHP Warning:  require_once(/public_html/cdn/wp-content/plugins/xml-sitemap-feed/views/feed-sitemap-pt.php): failed to open stream: No such file or directory in /public_html/wp-includes/template.php on line 770
    [25-Jan-2022 12:55:18 UTC] PHP Fatal error:  require_once(): Failed opening required '/public_html/cdn/wp-content/plugins/xml-sitemap-feed/views/feed-sitemap-pt.php' (include_path='.:/opt/alt/php74/usr/share/pear') in /public_html/wp-includes/template.php on line 770

    What you could try is copy the xsl files that are inside the assets directory to your theme folder (but not the assets folder itself). The plugin will use the files from your theme instead of the ones from the plugin assets folder.

    But I’m not sure if that will change anything for the original issue…

    You may want to contact the CDN Linker developers about wp_make_link_relative compatibility and if there is a work-around for that…

    Thread Starter i0n1ca

    (@i0n1ca)

    I have copied inside xls files from assets directory into the root of the theme. I hope this will solve the php fatal error and no logs will be generated.

    Regarding the first problem, I will dig more maybe I can find a solution. For now, the manual copy of the assets directory solved the stylesheet problem. If needed, I will do it manualy everytime you update the plugin but my concern now is to get rid of the error_log with feed-sitemap-pt.php that doesn’t exists.

    Thread Starter i0n1ca

    (@i0n1ca)

    I have fixed the stylesheet by adding /cdn in front of wp_make_link_relative in controllers/functions.shared.php on line 54

    echo '<?xml-stylesheet type="text/xsl" href="/cdn' . wp_make_link_relative( $url ) . '?ver=' . XMLSF_VERSION . '"?>' . PHP_EOL;

    I have tried to put xls files from assets folder into theme folder but I keep getting errors. Why it is keep trying to run a file called feed-sitemap-pt.php that doesn exist?

    /xml-sitemap-feed/views/feed-sitemap-pt.php No such file or directory

    Why it is keep trying to run a file called feed-sitemap-pt.php that doesn exist?

    That file does indeed not exist but it looks like someone is trying to access the non-existent sitemap /sitemap-pt.xml on your site. This causes the error… I’ll see if I can prevent this from happening in the next release.

    About the relocation of your /wp-content directory: have you set the WP_CONTENT_DIR constant in your wp-config.php file? If not, you might find the instructions on https://paulund.co.uk/move-wp-content-folder-to-different-location useful. This should make wp_make_link_relative return the correct relative file location.

    Thread Starter i0n1ca

    (@i0n1ca)

    I don’t have any other xml plugin for sitemap, that’s strange. The error appeared only after installing your plugin because it points to views folder inside xml-sitemap-feed.

    In the error_log file beside sitemap-pt.xml I have this line

    /public_html/wp-includes/template.php on line 770

    This belongs to wordpress core files in /wp-includes/:

    if ( $require_once ) {
    		require_once $_template_file;
    	} else {
    		require $_template_file;

    Line 770 points to require_once $_template_file; maybe this will help you.

    Yes, WP_CONTENT_DIR / URL and WP_PLUGIN_DIR / URL are already setup in wp-config years ago when CDN linker was installed by me.

    Yes, the error does come from this plugin but only if a non-existant sitemap is requested. Someone or something must be trying to access the address /sitemap-pt.xml which causes this plugin to try and load a template with the name feed-sitemap-pt.php (which also does not exist). The issue will be addressed in the next version.

    Yes, WP_CONTENT_DIR / URL and WP_PLUGIN_DIR / URL are already setup in wp-config years ago when CDN linker was installed by me.

    Okay, I’ll have to do some testing then… What does CDN Linker actually do? Because I see no file references with /cdn/ in your page source code anywhere, only https://cdn.

    Is CDN Linker programmed to transform every URL with /cdn/ to https://cdn.? That might explain why wp_make_link_relative no longer reflects the correct WP_CONTENT_DIR/URL…

    Thread Starter i0n1ca

    (@i0n1ca)

    Yes, you’re right ??

    At the begining I have put /wp-admin and /wp-content and /wp-includes to a subdomain called cdn, now I have only wp-content. Yes, CDN Linker can help you use images, plugins, themes any wordpress content from another subdomain or another host.

    As you know a subdomain only offers you a directory in the root of your hosting. The CDN Linker points to a different location setup in settings and in wp-config from www.isay.ro/cdn/wp-content to cdn.isay.ro/wp-content. I think he rewrites the path.

    • This reply was modified 3 years, 1 month ago by i0n1ca.

    Why use this cdn subdomain at all, if it’s hosted on the same server?

    Thread Starter i0n1ca

    (@i0n1ca)

    I used to have /wp-content folder to another host, now I am planning to change my theme and move again /wp-content to another host. I don’t want to go again through changing all the image links in database.

    changing all the image links

    Isn’t that what CDN Linker should do automatically?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘White page with wrong xsl file’ is closed to new replies.