Skip to content

Commit

Permalink
Theme: Use data file to abstract sitenav and separate Amethyst config
Browse files Browse the repository at this point in the history
* Give the theme a name, Amethyst, after the purple gemstone.

* Abstract the sitenav into a data file to prepare for future
  re-use.

* Move the theme-related config into a subproperty named after
  the theme.
  • Loading branch information
Krinkle committed Jul 26, 2020
1 parent be95630 commit 4a77c44
Show file tree
Hide file tree
Showing 9 changed files with 626 additions and 612 deletions.
4 changes: 0 additions & 4 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
Copyright OpenJS Foundation and other contributors, https://openjsf.org/

This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/qunitjs/qunitjs.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To update Jekyll and any plugins (e.g. after changes to `Gemfile`):
bundle update
```

To regenerate the site and serve locally at <http://127.0.0.1:4000/>:
To regenerate the site and serve locally at <http://localhost:4000/>:

```shell
bundle exec jekyll serve
Expand Down
13 changes: 7 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ plugins:

# Theme
# We have a custom theme so the Jekyll is ignored.
# But, the default theee setting for github-pages is 'primer',
# which Jekyll would still compile. This is a problem because
# since at least 2015, the combination of Jekyll/Sass/Primer has
# But, the default theme setting for github-pages is 'primer',
# which Jekyll would still try to compile. This is a problem because
# since at least 2015, the combination of Jekyll/Sass/Primer is
# broken and simply doesn't compile out of-the-box.
#
# - https://github.com/jekyll/jekyll/issues/7426
Expand All @@ -36,9 +36,10 @@ plugins:
# Workaround by using the 'minima' for this no-op setting,
# which does compile an (unused) file without issue.
theme: minima
twitter_username: qunitjs
github_username: qunitjs
gitter_room: qunitjs/qunit
amethyst:
twitter: qunitjs
github: qunitjs
gitter: qunitjs/qunit

# Conversion
highlighter: rouge
Expand Down
13 changes: 13 additions & 0 deletions _data/sitenav.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Guides
href: /guides/
sub:
- name: Getting Started
href: /intro/
- name: Plugins
href: /plugins/
- name: 2.x Upgrade Guide
href: /upgrade-guide-2.x/
- name: Documentation
href: https://api.qunitjs.com
- name: About
href: /about/
6 changes: 3 additions & 3 deletions _includes/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<meta property="og:description" content="{{ excerpt | strip_html | truncate: 200 | normalize_whitespace | escape }}">
{% endif -%}

{%- if site.twitter_username -%}
<meta name="twitter:creator" content="@{{ site.twitter_username | escape }}">
<meta name="twitter:site" content="@{{ site.twitter_username | escape }}">
{%- if site.amethyst.twitter -%}
<meta name="twitter:creator" content="@{{ site.amethyst.twitter | escape }}">
<meta name="twitter:site" content="@{{ site.amethyst.twitter | escape }}">
{% endif -%}
<meta name="twitter:card" content="summary_large_image">
41 changes: 14 additions & 27 deletions _layouts/wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,20 @@
{% include search.html %}
</div>

<nav class="site-nav">
<ul class="site-nav-list">
<li class="site-nav-item has-sub-list">
<a class="site-nav-link has-sub-list" href="{% link guides.md %}">
Guides
</a>

<nav class="site-nav"><ul class="site-nav-list">
{%- for item in site.data.sitenav %}
<li class="site-nav-item{%- if item.sub %} has-sub-list{% endif %}">
<a class="site-nav-link{%- if item.sub %} has-sub-list{% endif %}" href="{{ item.href | escape }}">{{ item.name }}</a>
{%- if item.sub %}
<ul class="site-nav-sub-list">
<li><a class="site-sub-nav-link" href="{% link intro.md %}">Getting Started</a></li>
<li><a class="site-sub-nav-link" href="{% link plugins.md %}">Plugins</a></li>
<li><a class="site-sub-nav-link" href="{% link upgrade-guide-2.x.md %}">2.x Upgrade Guide</a></li>
{%- for sub in item.sub %}
<li><a class="site-sub-nav-link" href="{{ sub.href | escape }}">{{ sub.name }}</a></li>
{%- endfor %}
</ul>
{%- endif %}
</li>

<li class="site-nav-item">
<a class="site-nav-link" href="https://api.qunitjs.com">
Documentation
</a>
</li>

<li class="site-nav-item">
<a class="site-nav-link" href="{% link about.md %}">
About
</a>
</li>
</ul>
</nav>
{%- endfor %}
</ul></nav>

<div class="site-toggles">
<button class="search-toggle toggle" data-opens=".site-search" aria-expanded="false">
Expand Down Expand Up @@ -94,9 +81,9 @@
<footer class="site-footer">
<div class="wrapper">
<p class="external-links">
<a href="https://github.com/{{ site.github_username | escape }}" target="_blank" rel="noopener noreferrer">GitHub</a>
<a href="https://twitter.com/{{ site.twitter_username | escape }}" target="_blank" rel="noopener noreferrer">Twitter</a>
<a href="https://gitter.im/{{ site.gitter_room | escape }}" target="_blank" rel="noopener noreferrer">Chat</a>
<a href="https://github.com/{{ site.amethyst.github | escape }}" target="_blank" rel="noopener noreferrer">GitHub</a>
<a href="https://twitter.com/{{ site.amethyst.twitter | escape }}" target="_blank" rel="noopener noreferrer">Twitter</a>
<a href="https://gitter.im/{{ site.amethyst.gitter | escape }}" target="_blank" rel="noopener noreferrer">Chat</a>
</p>

<p class="copyright">Copyright &copy; 2020 <a href="https://openjsf.org/" target="_blank" rel="noopener noreferrer">OpenJS Foundation</a> and contributors</p>
Expand Down
Loading

0 comments on commit 4a77c44

Please sign in to comment.