Skip to content

Commit

Permalink
Readd jekyll-github-metadata plugin to site (just-the-docs#1108)
Browse files Browse the repository at this point in the history
In my other cleaning, I also noticed:

- the contributors pane on the homepage is broken
- the following link to a repo page in the search docs is broken

<img width="762" alt="Screenshot 2023-01-03 at 6 41 49 PM" src="https://user-images.githubusercontent.com/14893287/210474679-bcb9af23-0a4e-4999-a0ec-f06d967ea726.png">

In particular, the generated HTML is

```html
<a href="/blob/main/assets/js/zzzz-search-data.json">this content</a>
```

Looking at the source code for both features

```html
<ul class="list-style-none">
{% for contributor in site.github.contributors %}
  <li class="d-inline-block mr-1">
     <a href="{{ contributor.html_url }}"><img src="{{ contributor.avatar_url }}" width="32" height="32" alt="{{ contributor.login }}"></a>
  </li>
{% endfor %}
</ul>
```

```md
[this content]({{ site.github.repository_url }}/blob/main/assets/js/zzzz-search-data.json).
```

It's clear that `site.github` is not being populated. This is controlled by the GitHub Metadata/[`jekyll-github-metadata`](http://jekyll.github.io/github-metadata/) plugin.

I'm not when this stopped working. If I had to guess, I think this is packaged as part of the `github-pages` gem; so, when the site moved off of it a while back, we never noticed this regression. This is the type of thing that can hopefully be caught by regression tests in the future.

This PR re-adds the plugin. I've opted to only add it to the `Gemfile` but not the `gemspec` so that it only affects our site. In other words, JtD does not have `jekyll-github-metadata` as a runtime dependency (since none of our theme code relies on it). Happy to change that if we'd like.

---

In the future, 

- short-term: I can write a filter that removes dependabot from our contributors
- longer-term: we could rewrite the "last edited on GitHub" feature to instead use `jekyll-github-metadata`. this would necessitate us to make it a runtime dependency, and it also wouldn't work as well for users of GitLab or other alternatives.
mattxwang authored Feb 14, 2023
1 parent 27ae8d3 commit 0484b45
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
source "https://rubygems.org"
gemspec

gem "jekyll-github-metadata", ">= 2.15"

gem "webrick", "~> 1.7"
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ title: Just the Docs
description: A Jekyll theme for documentation
baseurl: "/just-the-docs" # the subpath of your site, e.g. /blog
url: "https://just-the-docs.github.io" # the base hostname & protocol for your site, e.g. http://example.com
repository: just-the-docs/just-the-docs # for github-metadata

permalink: pretty

@@ -161,6 +162,7 @@ callouts:

plugins:
- jekyll-seo-tag
- jekyll-github-metadata

kramdown:
syntax_highlighter_opts:

0 comments on commit 0484b45

Please sign in to comment.