github / pages-gem

A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages
http://pages.github.com
MIT License
1.83k stars 354 forks source link

Disable jekyll-github-metadata gem when building locally #417

Open fayndee opened 7 years ago

fayndee commented 7 years ago

Before submitting an issue, please be sure to

This issue affects

What did you do (e.g., steps to reproduce)

Run bundle exec jekyll serve from a fresh github-pages repo.

What did you expect to happen?

All build smoothly.

What happened instead?

GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

Additional information

The github-pages project I'm trying to setup does not need any metadata from my github repository. Is there a way to disable jekyll-github-metadata gem when building locally?

PS: I'm aware of the authentication configuration needed for jekyll-github-metadata gem, but since I'm not going to use any of those metadata, it will be awful if I have to do so.

benbalter commented 7 years ago

@parkr is this because we're grabbing the metadata for site.url and site.baseurl? If the authentication on those endpoints have changed, are there now any endpoints that require authentication? Can we suppress this error until a rate limit is reached?

parkr commented 7 years ago

GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

This is totally fine – you are safe to ignore this. It's only a warning so that if things are broken, you know that this could be why.

is this because we're grabbing the metadata for site.url and site.baseurl

@benbalter No, we only set it in production.

benbalter commented 7 years ago

This is totally fine – you are safe to ignore this.

@parkr two questions:

  1. If the user has no use of the site.github namespace, and they're not using site.url since it's local, why is the metadata plugin warning about a lack of API token?

  2. This isn't the first time this has come up (warning/error output that looks concerning to newer users). Beyond suppressing the output when not used, any way we can make it clearer what the implications are?

fayndee commented 7 years ago

@benbalter agreed.

It might be just a warning at the first place, but after some time it will quickly turn into some serious looking error like: GitHub API rate limit exceeded, which is kind of annoying for new users.

parkr commented 7 years ago

Ben, always good for hard-hitting questions! 😄

If the user has no use of the site.github namespace, and they're not using site.url since it's local, why is the metadata plugin warning about a lack of API token?

When the site regenerates, site.github, if it wasn't present before, is not an instance of MetadataDrop. When the site calls #generate for a second time on our GHP generator, it calls #github_namespace which merges the pre-existing site.github with the metadata drop. The way the merging happens, is it fetches all the keys, and overrides the existing values with the new value, thus *calling each of the `site.github.` fields**. When it goes to create the client to call out to the GitHub API, it yields this message.

I think we should change this so that the generator only runs once for a given session, as the MetadataDrop will automatically load fields as needed.

This isn't the first time this has come up (warning/error output that looks concerning to newer users). Beyond suppressing the output when not used, any way we can make it clearer what the implications are?

We just have to be a bit less scary in our message, or print as white (info) instead of yellow (warning).

seanburlington commented 5 years ago

It sounds like this isn't actually warning or informing of anything.

So it's annoying in that I just spent a while digging around seeing if I was doing something wrong and it seems not - this is just what happens of using the github-pages gem locally.

gamepad-coder commented 4 years ago

Found this issue's page after much googling.

Wanted to briefly outline my experience in case it provides useful insight about how new users perceive this.


As a new user of Ruby + Jekyll + GitHub Pages, this was confusing to me. I was under the impression that maybe :

Specifically, I was worried this warning was related to this portion from https://help.github.com/en/github/working-with-github-pages/testing-your-github-pages-site-locally-with-jekyll :

2020-05-23 12_35_38-Testing your GitHub Pages site locally with Jekyll - GitHub Help

If I hadn't found this issue's url and the information here, I likely would have spent a couple more hours attempting blind troubleshooting. Awesome clarifications, thanks.


All in all, really love this tool. My thanks to the contributors.

Parikshit87 commented 3 years ago

Hi, I am a new user of Jekyll. I was able to run my site locally with all pages and posts that were visible from the home page. However, after I changed the theme and made some experiments, I see the link of those pages and posts are removed from the home page. The page display is same both locally or globally. Would be great if someone can update me the fixes?

Link of my repo parikshitdemoblogs - https://github.com/Parikshit87/parikshitdemoblogs