Reputation: 4975
I am trying to build a github-pages site and to preview it offline. However, I have only partial success, while the page I get served comes from my offline sources, all its resources (css/img) and links point to the github location of the site.
I use {{ site.github.url }}
, installed jekyll as described here.
I tried bundle exec jekyll clean
, and attempted to git remote remove origin
and to unset github_username
. However, without the remote the site would not build and with it (without a username), it still knew my username as it still generated links to <username>.github.io/repo/
rather than 127.0.0.1:3000
(I changed the port).
How can I test my github pages offline properly (i.e. have the links point to my local jekyll instance)?
Important: When I fire up bundle exec jekyll serve
I get the following warning:
GitHub Metadata: No GitHub API authentication could be found. Some fields > may be missing or have incorrect data.
As far as I am aware this comes from jekyll-github-metadata
which populates site.github
. And as such (I assume) site.github.url
. However, I have not found if this caches data, and how to wipe this data. As I am trying to build an offline test I do want this url to be empty/ point to localhost.
===============================
Header layout excerpt:
<head>
<title>A title</a>
<link rel="stylesheet" href="{{ site.github.url }}/css/bootstrap.min.css">
</head>
As this <head>
section/this layout is used in different parts of the page hierarchy, I need an absolute path to link to the css file.
Upvotes: 3
Views: 2359
Reputation: 1476
If you are still experiencing this issue, I have a blog post and video showing how to fix it. The skinny of it is this:
The blog post assumes you are on a Windows machine, but the same steps should work on a Mac.
Upvotes: -1
Reputation: 52789
Replace : {{ site.github.url }}/css/bootstrap.min.css
by : {{ site.baseurl }}/css/bootstrap.min.css
Github metadata plugin provides common repository information and is not supposed to be used to generate your resources urls. I don't even see it mentioned in the documentation you're referencing.
You don't need it to have Jekyll working locally.
Upvotes: 2