-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating Sitemap XML files for SSG (Static Site Generator) #92
Comments
Hey @bradleyflood , Thank you for flagging this for us, we've not done a massive amount of testing with the SSG package but you're absolutely right that this is something that should be supported by Aardvark so I'll schedule in some time on our end to take a look into this. Thanks, |
Thanks @AndrewHaine This might help you, or someone else. I wrote a Node script that is run during the composer build step which fetches the sitemap files from my local Statamic instance, replaces the paths to production paths, and then writes them to file in the SSG output directory. See gist here https://gist.github.com/bradleyflood/b77944f5ef486c2da3ce5038cb348146 Cheers. Love your work! Aardvark is great. |
Hey @bradleyflood , Thank you for sending that over. I've been digging into the SSG addon a bit and it looks like we're able to register custom callbacks for when the SSG command is executed, i've opened a task internally for us to schedule some time in to write an integration for Aardvark - will reply here once we've got something in place! Thanks, |
Cool thanks @AndrewHaine. If you need a beta tester I'm available. Cheers. |
There is a simple way to merge the sitemap urls with SSG, just need to find out how any assets or other files might need to be required... but I'm still experimenting with the addon. <?php
namespace App\Providers;
use WithCandour\AardvarkSeo\Sitemaps\Sitemap;
use Statamic\StaticSite\SSG;
class AppServiceProvider extends ServiceProvider
{
public function boot() {
SSG::addUrls(function () {
// get an array with local urls ['sitemap.xml', 'sitemap_articles.xml', 'etc']
// sitemaps will still include APP_URL in the results
$sitemaps = collect(Sitemap::all())->pluck('route')->push('sitemap.xml', 'aardvark-sitemap.xsl')->all();
return array_merge(
$sitemaps,
// my other urls
);
});
}
...
} It seems like the vendor files are copied over automatically: storage/app/static/vendor/aardvark-seo
├── css
│ └── aardvark-seo.css
└── js
└── aardvark-seo.js |
Have there been any updates on this? |
Hi :)
I'm yet to find information on exporting the sitemap XML files for a static site using Statamic's SSG package.
When I run
php please ssg:generate
the outputted static files have no sitemaps, which makes sense because they are dynamically generated.But I've tried including the routes in the SSG config, such as
/sitemap.xml
inconfig/statamic/ssg.php
=>urls
array, but that doesn't help.It's looking like I will have to write a custom script to fetch the
/sitemap.xml
, parse it and fetch other sitemap files too, and then write them to file in the SSG output folder.Am I missing something? I imagine I'm not the only one using Aardvark SEO and SSG together?
Cheers and thank you for your time. 🍻
The text was updated successfully, but these errors were encountered: