Skip to content

Commit

Permalink
Add warning capability for OpenSearch section (#6086) (#6087)
Browse files Browse the repository at this point in the history
(cherry picked from commit d1f230a)

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 119c395 commit 06f7f4d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ heading_anchors: false
# Adds on-hover anchor links to h2-h6
anchor_links: true

# This setting governs including warning on every page
# 'unsupported' produces red warning, 'supported' produces yellow warning
# everything else produces no warning
doc_version: latest

footer_content:

plugins:
Expand Down
7 changes: 7 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@
{% endif %}
{% endunless %}
<div id="main-content" class="main-content" role="main">
{% if page.section == "opensearch" %}
{% if site.doc_version == "supported" %}
<p class="supported-version-warning">This is an earlier version of the OpenSearch documentation. For the latest version, see the <a href="{{ site.url }}/docs{{ page.url }}">current documentation</a>. For information about OpenSearch version maintenance, see <a href="https://opensearch.org/releases.html">Release Schedule and Maintenance Policy</a>.</p>
{% elsif site.doc_version == "unsupported" %}
<p class="unsupported-version-warning">This version of the OpenSearch documentation is no longer maintained. For the latest version, see the <a href="{{ site.url }}/docs{{ page.url }}">current documentation</a>. For information about OpenSearch version maintenance, see <a href="https://opensearch.org/releases.html">Release Schedule and Maintenance Policy</a>.</p>
{% endif %}
{% endif %}
{% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
{% else %}
Expand Down
21 changes: 21 additions & 0 deletions _sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,27 @@ img {
border-left: 5px solid $red-100;
}

@mixin version-warning ( $version: 'latest' ){
@extend %callout, .panel;
font-weight: 600;
@if $version == 'unsupported' {
border-left: 5px solid $red-100;
background-color: mix(white, $red-100, 80%);
}
@else if $version == 'supported' {
border-left: 5px solid $yellow-000;
background-color: mix(white, $yellow-000, 80%);
}
}

.supported-version-warning {
@include version-warning('supported');
}

.unsupported-version-warning {
@include version-warning('unsupported');
}

// Labels
.label,
.label-blue {
Expand Down

0 comments on commit 06f7f4d

Please sign in to comment.