Closed GiacomoLaw closed 5 years ago
It should be generated automatically every time you do jekyll build or serve - that includes when you push to GitHub, etc. Look for it in _site after a local build.
It's here: https://giacomolaw.me/blog/sitemap.xml Generated files are not versioned, only source files.
I manually made those. I cant find a _site folder.
You've done all these steps?
That creates the _site directory (which may be called something else if you've overridden it) which contains all the generated pages, including the sitemap.xml.
But also, see the note on GitHub Pages in the jekyll-sitemap README.md here: https://github.com/jekyll/jekyll-sitemap
So I need to generate it locally, and once done it will generate automatically?
Okay, I’ll give it a go. Thanks!
@GiacomoLaw You don't need to. GitHub Pages will automatically build your site everytime you push a commit. You can build your site locally though to check your changes are OK before pushing to GitHub.
@GiacomoLaw You don't need to. GitHub Pages will automatically build your site everytime you push a commit. ...
@DirtyF that’s where I’m having the issue. It’s not building the site map when I push to the repo.
GitHub Pages Help should help you find why: https://help.github.com/articles/viewing-jekyll-build-error-messages/
@GiacomoLaw I took a peek into your site's repository. The repository contents are "generated HTML files", not source files for Jekyll. So there's nothing for GitHub Pages to build upon.
To continue in the same fashion, you have to generate the sitemap locally and push it to your repo.
Ah, okay. Thanks!
Hello, I have generated the sitemap locally however this is what I get in the sitemap under _site:
How can I get it to replace localhost with my domain?
The repo is: https://github.com/GiacomoLaw/blog
I have yet to push my changes, as _site
is under .gitignore
.
Thanks!
When you push to GitHub, _site will be rebuilt by GitHub, and localhost will be replaced with whatever you've configured url to be in _config.yml.
@GiacomoLaw To replace localhost
with site.url
setting, build with setting JEKYLL_ENV
to 'production'
:
If on Windows:
set JEKYLL_ENV=production
bundle exec jekyll build
Otherwise:
JEKYLL_ENV=production bundle exec jekyll build
This can get tedious at times. So, the better solution is to save the above in a BASH shell script if you have BASH installed:
#!/usr/bin/env bash
# jekyll production script
# filename: build-site
JEKYLL_ENV=production bundle exec jekyll build
Now, simply run the above script:
bash ./build-site
@PGScully @ashmaroli Thank you both! I will give it a go. I'll first try just pushing it and seeing if Github rebuilds it.
How can I exclude a page from the sitemap?
Thank you!
How can I exclude a page from the sitemap?
In the page's front matter:
---
sitemap: false
---
Thank you!
I have now pushed it with _site
to Github.
https://github.com/GiacomoLaw/blog
Is everything okay here? Will all the links work fine?
https://github.com/GiacomoLaw/blog/blob/master/_site/sitemap.xml
Is the sitemap all good?
Thanks!
Is the sitemap all good?
If it looks good to you, it is: https://giacomolaw.me/blog/sitemap.xml
Thanks so much for your help! Adding bash to windows and going to use that script.
Thanks :D
Are these scripts what people put in these dotfile repos?
Nope. And that discussion is outside the scope of this repository.
Regarding the script above, you can swap jekyll build
with jekyll serve
if you want a production preview locally.
:v:
Yep, used jekyll serve
. What does enabling --watch
do? Will this update my sitemap even if I do not build the site?
Thanks, appreciate the help.
When --watch
is enabled with jekyll build
, Jekyll will automatically update the contents of _site
based on changes you make to the source files. It's the same as jekyll serve
but lacks a preview server.
For continued discussion please register at https://talk.jekyllrb.com/ GitHub Repos in Jeyll org is only for bug reports.
Okay, thanks. Final question, when I build do I do bundle exec jekyll build --watch
, and then I won't need to build again?
Thanks and apologies for moving from the topic scope.
My google verification file is being mapped:
How can I stop this?
I have it in config, but I see nothing added to my repo. How can I get a sitemap?
Thanks