GithubHelp home page GithubHelp logo

Comments (3)

timwis avatar timwis commented on June 23, 2024

I've written a Netlify Build plugin (98a812b) to generate a _config_override.yml file, but issue 1 and 4 above still remain for some reason. I'll see if I can reproduce them locally by setting JEKYLL_ENV=production on my laptop's build.

from jkan.

timwis avatar timwis commented on June 23, 2024

Okay, I've dug in a lot deeper to the github-metadata gem, and I think I understand what's behind the two main issues:

  • It's setting site.github.source.branch to the default branch of the upstream repository, not the fork. This probably isn't an issue in practice, but could be (whether for debugging, or if an admin wants to change the default branch of their repo, since they're not actually using github pages)
  • It's setting baseurl according to the fact that the repository is a "user repository" rather than an "org repository". The plugin's designed to get the site working on github pages, and not for compatibility elsewhere. I've solved this one by explicitly declaring baseurl: "" in _config_override.yml

Very nearly there!

from jkan.

timwis avatar timwis commented on June 23, 2024

All right, I've reported the branch issue on the github-metadata repo, and implemented a workaround: the Netlify Build Plugin now saves the name of the branch being deployed to site.branch. When we configure the Editor UI in /editor/index.html, it now says branch: {{ site.branch | default: site.github.source.branch }}, using the value from the config if it's available, and defaulting back to whatever's generated by the github-metadata gem.

So, just to recap, we've essentially made the github-metadata gem "get out of the way" when deploying to Netlify. We do this by generating a supplemental _config.ci.yml file during the build process — but only in a Netlify build (via a Netlify build plugin). Jekyll loads this _config.ci.yml first, then loads the normal _config.yml, so an admin can override anything that's generated, if they prefer.

I think once we switch the GitHub Pages approach to using Actions, we should explore moving away from the github-metadata gem (because we can have the Action generate a _config.ci.yml file as well).

from jkan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.