Skip to content

Commit

Permalink
Merge branch 'single-release-per-major__master'
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Jan 29, 2022
2 parents 91dab22 + ae134d2 commit 0dd4d93
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 79 deletions.
1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ url: 'https://sinonjs.org'
github_username: sinonjs
sinon:
current_release: v13.0.0
current_major_version: 13
markdown: kramdown
kramdown:
input: GFM
Expand Down
12 changes: 6 additions & 6 deletions docs/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@

{% comment %}
To make all documentation pages, regardless of version, lead search traffic to the latest version,
we need to point all the pages under /releases/v*/ to their latest version
we need to point all the pages under /releases/v*/ to the latest version
{% endcomment %}

{% assign url_parts = page.url | split: "/" %}

{% if page.url contains "/releases/v" } %}
{% assign canonical_page_url = "/releases/latest/" | append: url_parts[3] %}

{% if url_parts[2] != {site.sinon.current_release} %}
<script>
site.showBanner = true; // cannot dynamically create a globally available Liquid variable
</script>
{% endif %}
<script>
const releaseVersionWithPrefix = "{{ url_parts[2]}}";
const majorVersion = "{{site.sinon.current_major_version}}"
site.showBanner = releaseVersionWithPrefix != `v${majorVersion}`; // cannot dynamically create a globally available Liquid variable
</script>
{% else %}
{% assign canonical_page_url = page.url | replace:'index.html','' %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a href="{{ site.baseurl }}/releases/{{site.sinon.current_release}}">Documentation</a></li>
<li><a href="{{ site.baseurl }}/releases/v{{site.sinon.current_major_version}}">Documentation</a></li>
<li><a href="{{ site.baseurl }}/releases/">Releases</a></li>
<li><a href="{{ site.baseurl }}/guides/">Guides</a></li>
<li><a href="{{ site.baseurl }}/how-to/">How To</a></li>
Expand Down
11 changes: 6 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
---

{% assign current_release = site.sinon.current_release %}
{% assign current_major = site.sinon.current_major_version %}

## Get Started

Expand Down Expand Up @@ -284,9 +285,9 @@ You've seen the most common tasks people tackle with Sinon.JS, yet we've only sc

Christian Johansen's book [Test-Driven JavaScript Development][tddjs] covers some of the design philosophy and initial sketches for Sinon.JS.

[fakes]: /releases/{{current_release}}/fakes
[fakexhr]: /releases/{{current_release}}/fake-xhr-and-server
[fakeserver]: /releases/{{current_release}}/fake-xhr-and-server#fake-server
[clock]: /releases/{{current_release}}/fake-timers
[api-docs]: /releases/{{current_release}}
[fakes]: /releases/v{{current_major}}/fakes
[fakexhr]: /releases/v{{current_major}}/fake-xhr-and-server
[fakeserver]: /releases/v{{current_major}}/fake-xhr-and-server#fake-server
[clock]: /releases/v{{current_major}}/fake-timers
[api-docs]: /releases/v{{current_major}}
[tddjs]: http://tddjs.com/
1 change: 1 addition & 0 deletions docs/release-source/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
title: API documentation - Sinon.JS
skip_ad: true
release_id: master
sort_id: master
---

# {{page.title}} - `{{page.release_id}}`
Expand Down
6 changes: 5 additions & 1 deletion docs/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1>Releases</h1>

<div class="in-content releases">
<ul>
{% assign sorted_releases = site.releases | sort | reverse %}
{% assign sorted_releases = site.releases | sort: "sort_id" | reverse %}
{% for release in sorted_releases %}
{% assign url_parts = release.url | split: "/" %}

Expand Down Expand Up @@ -65,3 +65,7 @@ <h2 id="npm-cdns">Using NPM based CDNs</h2>
would download the latest browser bundle of Sinon 3.
</p>
</div>

{% comment %}
vim: ft=liquid
{%endcomment %}
155 changes: 100 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"proxyquireify": "^3.2.1",
"puppeteer": "^13.1.2",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"shelljs": "^0.8.4"
},
"files": [
Expand Down
Loading

0 comments on commit 0dd4d93

Please sign in to comment.