Add warning capability for OpenSearch section (#6086)

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
This commit is contained in:
kolchfa-aws 2024-01-09 10:50:05 -05:00 committed by GitHub
parent 970d85d913
commit d1f230aff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

View File

@ -280,6 +280,11 @@ heading_anchors: false
# Adds on-hover anchor links to h2-h6 # Adds on-hover anchor links to h2-h6
anchor_links: true 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: footer_content:
plugins: plugins:

View File

@ -163,6 +163,13 @@ layout: table_wrappers
{% endif %} {% endif %}
{% endunless %} {% endunless %}
<div id="main-content" class="main-content" role="main"> <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 %} {% 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%\"" %} {% 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 %} {% else %}

View File

@ -187,6 +187,27 @@ img {
border-left: 5px solid $red-100; 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 // Labels
.label, .label,
.label-blue { .label-blue {