Static WordPress Community

Cannot get xml sitemaps or ads.txt files to generate

Hi, I’m using Lokl and WP2Static w/ Netlify addon and I am unable to have xml sitemaps or ads.txt generated properly.

I’ve tried Yoast SEO and The SEO Framework plugins and the xml sitemaps 404 when using either plugin.

I’m also using Ads.txt Manager for managing my ads.txt file and it also 404s when trying to output my ads.txt file.

Any thoughts on how I can get both of these to work properly?

Hi @LuchaBeast - what version of WP2Static are you using? There were some sitemap fixes in the latest source code on GitHub which isn’t in a compiled release/installer file yet which may resolve this issue for you…

(may resolve the sitemaps issue, I’m less familiar with ads.txt, not sure if the manager plugin will work, but manually including an ads.txt and ensuring it’s included in the crawl should work fine)

Hi Leon, thank you for the quick reply.

I am using the version that comes preinstalled in Lokl.

It appears to be Version 7.1.7-dev.

Regarding, your second point about ads.txt, how do I go about manually including an ads.txt file and including it in the crawl?

Hi @LuchaBeast,

Glad you caught me while I’m online :smiley:

For manually adding a path to be crawled, you can use this filter, wp2static_modify_initial_crawl_list (this is a much more complicated example of using that filter, but some searching may show some simpler examples, basically, use WP’s add_filter() command to take an array as input and inject /ads.txt into it).

We’re currently at version 7.2.0-dev in GitHub - WP2Static/wp2static: WordPress static site generator for security, performance and cost benefits

I’m dragging my feet to get that release out and to update Lokl with those versions, sorry!

You can build a new installable ZIP from the source code if you’re comfortable with Composer, by running composer build wp2static-7.2.0 (after composer install).

If not comfortable, please ping me and I’ll try to build a version from source for you, but may take me a little while.

@leonstafford Unfortunately, I have minimal exposure to PHP, so I’d feel more comfortable with you building a version for me if it’s not too much of a hassle.

No problem at all, I’m just a bit rusty with the project of late, let’s see if my current system will build it :smiley:

1 Like

Please try to install this one:

Thanks, Leon.

The plugin works, but after trying again, it appears the issue I am running into is occurring prior to static site generation. My sitemap urls 404 on localhost, as well.

SEO plugin or no plugin, all sitemap urls on localhost are 404ing.

Default wordpress sitemap /wp-sitemap.xml = 404
Yoast sitemap /sitemap_index.xml = 404
The SEO framework sitemap /sitemap.xml = 404


Oh, that’s interesting! May well be an issue with Lokl.

OK, this looks it may be a known issue/very old todo item:

Not sure if there would be a quick fix in the meantime, sorry. I expect it requires a tweak to the Nginx config and didn’t find any quick obvious answers online, so will need to dig into a bit.

Ok. Thanks for investigating. Appreciate your time, Leon.

The fact you’re using Lokl and having issues is a good step towards me spending more time on it, though - I hadn’t heard any issues report for a while and haven’t used it myself for a while, but I am very fond of the tool and would love to get it used by more people.

Do you have an alternate setup you can use for now?

Unfortunately, no.

I just got back into website development recently and wanted something where I could easily manage some local wordpress installs and static site generation. I’d used wp2static in the past, but never Lokl until a few weeks ago.

My sites are relatively small, so not having sitemaps is not a huge miss currently, but would be a welcome addition because I do have some sites that I want to grow in size and sitemaps would start to come in handy for them.

EDIT: I should add that I wanted to start with something FREE, as well, so that’s why I went with Lokl.I looked into Strattic, but for someone who wants to mess around with numerous sites at the same time, Strattic is cost prohibitive.

Cool, totally understand!

For ads.txt and sitemaps, as a workaround, not ideal, but you may manually create and deploy them into the site, depending on where/how you’re publishing them, that may be OK for now, while starting out.

I should start using Lokl again for WP2Static development and testing, but I was also using it for Strattic work for a while as it’s very handy for rapidly spinning up a bunch of sites. Hopefully, I’ll reincorporate it into my workflow so I can fix some of the bugs and add some new features.

It does have some shared folders ability since a while back, which I found really handy…

I’m using the Netlify addon for deployment.