diff options
-rw-r--r-- | content/_data/default-nav.yaml | 2 | ||||
-rw-r--r-- | content/assets/stylesheets/stylesheet.scss | 2 | ||||
-rw-r--r-- | content/index.erb | 6 | ||||
-rw-r--r-- | layouts/404.html | 2 | ||||
-rw-r--r-- | layouts/archives.html | 4 | ||||
-rw-r--r-- | layouts/canonical_urls.html | 2 | ||||
-rw-r--r-- | layouts/default.html | 2 | ||||
-rw-r--r-- | layouts/feedback.html | 8 | ||||
-rw-r--r-- | layouts/footer.html | 2 | ||||
-rw-r--r-- | layouts/gtm.html | 2 | ||||
-rw-r--r-- | layouts/head.html | 2 | ||||
-rw-r--r-- | layouts/header.html | 2 | ||||
-rw-r--r-- | layouts/home.html | 2 | ||||
-rw-r--r-- | layouts/instantsearch.html | 2 | ||||
-rw-r--r-- | layouts/versions_dropdown.html | 2 | ||||
-rw-r--r-- | lib/helpers/generic.rb | 12 | ||||
-rw-r--r-- | lib/helpers/versions.rb | 2 | ||||
-rw-r--r-- | lib/helpers_.rb | 1 |
18 files changed, 35 insertions, 22 deletions
diff --git a/content/_data/default-nav.yaml b/content/_data/default-nav.yaml index 446bada9..2be2bf27 100644 --- a/content/_data/default-nav.yaml +++ b/content/_data/default-nav.yaml @@ -517,7 +517,7 @@ sections: - doc_title: Deprecated variables doc_url: 'ci/variables/deprecated_variables.html' - category_title: Environments - category_url: 'ci/environments/index.html' + category_url: 'ci/environments/' docs: - doc_title: Protected environments doc_url: 'ci/environments/protected_environments.html' diff --git a/content/assets/stylesheets/stylesheet.scss b/content/assets/stylesheets/stylesheet.scss index f832164f..f64652a6 100644 --- a/content/assets/stylesheets/stylesheet.scss +++ b/content/assets/stylesheets/stylesheet.scss @@ -1,5 +1,5 @@ --- -version: 66 +version: 67 --- @import "variables"; diff --git a/content/index.erb b/content/index.erb index 7d704998..8f6e2f46 100644 --- a/content/index.erb +++ b/content/index.erb @@ -7,7 +7,7 @@ title: GitLab Documentation <a href="/" class="list-group-item list-group-item-action active border-bottom-0 border-top-0 d-flex align-items-center text-decoration-none"> <%= icon('home', nil, 'menu-icon') %> Home </a> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <% @config[:products].each do |name, product| %> <% if product[:expose] == true %> <a href="<%= @items["/#{product[:slug]}/#{product[:index_file]}"].path %>" class="list-group-item list-group-item-action border-bottom-0 border-top-0"><%= icon(product[:icon], nil, 'menu-icon') %> <%= product[:short_name] %></a> @@ -33,7 +33,7 @@ title: GitLab Documentation </div> </div> <div class="row px-4" itemscope itemtype="http://www.schema.org/SiteNavigationElement"> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <% @config[:products].each do |name, product| %> <% if product[:expose] == true %> <% if product[:short_name] == 'GitLab' %> @@ -142,4 +142,4 @@ title: GitLab Documentation </div> </main> <aside class="sidebar-right d-none d-lg-block"></aside> -</section>
\ No newline at end of file +</section> diff --git a/layouts/404.html b/layouts/404.html index 59ad2d5b..56a4e96b 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -19,7 +19,7 @@ <%= render '/docsearch.*' %> <script type="application/javascript" src="<%= @items['/assets/javascripts/404.*'].path %>"></script> <script src="<%= @items['/frontend/404/404.*'].path %>"></script> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/archives.html b/layouts/archives.html index 30a934ca..e5636ef1 100644 --- a/layouts/archives.html +++ b/layouts/archives.html @@ -12,7 +12,7 @@ <div class="js-article-content"> <%= yield %> </div> - <% if ENV['NANOC_ENV'] == 'production' && ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> <%# Show Edit button only in production and on master branch (hide archives) %> <div class="edit-on"> <a class="btn btn-tanuki btn-default" href="<%= edit_on_gitlab(@item) %>">Edit this page</a> @@ -36,7 +36,7 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <%= render '/footer.*' %> <%= render '/docsearch.*' %> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/canonical_urls.html b/layouts/canonical_urls.html index 1b73967b..94a316ef 100644 --- a/layouts/canonical_urls.html +++ b/layouts/canonical_urls.html @@ -16,7 +16,7 @@ if the link doesn't end with README.md or index.md if the link doesn't start with ce use its initial path <% end %> -<% if ENV['NANOC_ENV'] == 'production' %> +<% if is_production? %> <% if (@item.identifier =~ /(index|README)\.md$/) == 0 %> <% if @item.identifier.to_s.split('/')[1] == 'ce' %> <link rel="canonical" href="<%= @config[:base_url] %>/ee/<%= @item.identifier.to_s.split('/')[2..-2].join('/') %><% unless @item.identifier.to_s.split('/')[2..-2].join('/').length == 0 %>/<% end %>" /> diff --git a/layouts/default.html b/layouts/default.html index 33afb234..20c90920 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -77,7 +77,7 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <%= render '/docsearch.*' %> <%= render '/mermaid.*' %> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/feedback.html b/layouts/feedback.html index f0e4634a..82f36a16 100644 --- a/layouts/feedback.html +++ b/layouts/feedback.html @@ -13,9 +13,9 @@ <div> <h5 class="help-and-feedback-heading">Docs</h5> <a class="help-and-feedback-link" href="<%= edit_on_gitlab(@item) %>" target="_blank">Edit this page</a> to fix an error or add an improvement in a merge request<br> - <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/issues/new?issue[title]=Docs%20feedback:%20Write%20your%20title&issue[description]=Link%20the%20doc%20and%20describe%20what%20is%20wrong%20with%20it.%0A%0A%3C!--%20Don%27t%20edit%20below%20this%20line%20--%3E%0A%0A%2Flabel%20~Documentation%20~%22docs%5C-comments%22%20" target="_blank">Create an issue</a> to suggest an improvement to this doc<br> + <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/-/issues/new?issue[description]=Link%20the%20doc%20and%20describe%20what%20is%20wrong%20with%20it.%0A%0A%3C!--%20Don%27t%20edit%20below%20this%20line%20--%3E%0A%0A%2Flabel%20~Documentation%20~%22docs%5C-comments%22%20&issue[title]=Docs%20feedback:%20Write%20your%20title" target="_blank">Create an issue</a> to suggest an improvement to this doc<br> <%# Show comments only in production and on master branch (hide archives) %> - <% if @item[:comments].nil? && ENV['NANOC_ENV'] == 'production' && ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if @item[:comments].nil? && is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> <% unless @item.identifier.to_s.split('/')[1] == 'ce' %> <a class="help-and-feedback-link" href="#" onclick="loadDisqus();return false;">Show and post comments</a> to review and give feedback on this doc <% end %> @@ -25,8 +25,8 @@ <div class="mt-3"> <h5 class="help-and-feedback-heading">Product</h5> - <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/issues/new?issue[title]=Docs%20-%20product%20feedback:%20Write%20your%20title&issue[description]=Describe%20what%20you%20would%20like%20to%20see%20improved.%0A%0A%3C!--%20Don%27t%20edit%20below%20this%20line%20--%3E%0A%0A%2Flabel%20~%22docs%5C-comments%22%20" target="_blank">Create an issue</a> if there's something you don't like about this feature<br> - <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/issues/new?issuable_template=Feature%20proposal&issue[title]=Docs%20feedback%20-%20feature%20proposal:%20Write%20your%20title" target="_blank">Propose functionality</a> by submitting a feature request<br> + <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/-/issues/new?issue[description]=Describe%20what%20you%20would%20like%20to%20see%20improved.%0A%0A%3C!--%20Don%27t%20edit%20below%20this%20line%20--%3E%0A%0A%2Flabel%20~%22docs%5C-comments%22%20&issue[title]=Docs%20-%20product%20feedback:%20Write%20your%20title" target="_blank">Create an issue</a> if there's something you don't like about this feature<br> + <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Feature%20proposal&issue[title]=Docs%20feedback%20-%20feature%20proposal:%20Write%20your%20title" target="_blank">Propose functionality</a> by submitting a feature request<br> <a class="help-and-feedback-link" href="https://about.gitlab.com/community/gitlab-first-look/" target="_blank">Join beta testing</a> to help shape new features </div> diff --git a/layouts/footer.html b/layouts/footer.html index 8a74cc88..24fbd432 100644 --- a/layouts/footer.html +++ b/layouts/footer.html @@ -5,7 +5,7 @@ <a href='https://gitlab.com/gitlab-org/gitlab-docs' target='_blank'>Created</a> with Nanoc, hosted on <a href='https://about.gitlab.com/stages-devops-lifecycle/pages/' target='_blank'>GitLab Pages</a> <a href='https://creativecommons.org/licenses/by-sa/4.0/' target='_blank' rel="license" alt="Creative Commons License"><img src='/assets/images/by-sa.svg'></a> <a href='/cookies-policy/' alt='Cookies Policy'>Cookies Policy</a> - <% if ENV['NANOC_ENV'] == 'production' && ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> <%# Show Edit button only in production and on master branch (hide archives) %> <div class="edit-on"> <i class="fa fa-code-fork" aria-hidden="true"></i> diff --git a/layouts/gtm.html b/layouts/gtm.html index 65f242c4..fcd29abf 100644 --- a/layouts/gtm.html +++ b/layouts/gtm.html @@ -1,4 +1,4 @@ -<% if ENV['NANOC_ENV'] == 'production' and ENV['CI_COMMIT_REF_NAME'] == 'master' %> +<% if is_production? and ENV['CI_COMMIT_REF_NAME'] == 'master' %> <%# Adds GTM only in production // leave this immediately after the opening the body tag%> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WZCXKT5" diff --git a/layouts/head.html b/layouts/head.html index 4f7a0204..4aa0a16f 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -32,7 +32,7 @@ <!-- Docsearch https://community.algolia.com/docsearch/ - via CDN --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"> <!-- end of docsearch --> -<% if ENV['NANOC_ENV'] == 'production' %> +<% if is_production? %> <%# Adds GTM only in production %> <!-- add cookie consent --> <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="36a06ac5-ddb4-4f91-8337-067ad19ad8d5" type="text/javascript"></script> diff --git a/layouts/header.html b/layouts/header.html index a666fb10..81a18fca 100644 --- a/layouts/header.html +++ b/layouts/header.html @@ -24,7 +24,7 @@ <div class="version-dropdown-mobile"> <%= render '/versions_dropdown.*' %> </div> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <% @config[:products].each do |name, product| %> <% if product[:expose] == true %> <li class="nav-item"> diff --git a/layouts/home.html b/layouts/home.html index d4a5636d..b08d4659 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -10,7 +10,7 @@ <%= render '/header.*' %> <%= yield %> <%= render '/docsearch.*' %> - <% if ENV['NANOC_ENV'] == 'production' and ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if is_production? and ENV['CI_COMMIT_REF_NAME'] == 'master' %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/instantsearch.html b/layouts/instantsearch.html index 3d0b89e2..6f33c3a9 100644 --- a/layouts/instantsearch.html +++ b/layouts/instantsearch.html @@ -22,7 +22,7 @@ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <%= render '/footer.*' %> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/versions_dropdown.html b/layouts/versions_dropdown.html index 6decfec3..9fee13f7 100644 --- a/layouts/versions_dropdown.html +++ b/layouts/versions_dropdown.html @@ -17,7 +17,7 @@ Version <% if archives? %> Archives <% else %> - <% if ENV['NANOC_ENV'] == 'production' %> + <% if is_production? %> <%= ENV['CI_COMMIT_REF_NAME'] == 'master' ? 'GitLab.com' : ENV['CI_COMMIT_REF_NAME'] %> <% else %> Versions diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb new file mode 100644 index 00000000..2bc27ea8 --- /dev/null +++ b/lib/helpers/generic.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Nanoc::Helpers + module Generic + # + # Check if NANOC_ENV is set to production + # + def is_production? + ENV['NANOC_ENV'] == 'production' + end + end +end diff --git a/lib/helpers/versions.rb b/lib/helpers/versions.rb index 5f5c3287..0ea5e174 100644 --- a/lib/helpers/versions.rb +++ b/lib/helpers/versions.rb @@ -24,7 +24,7 @@ module Nanoc::Helpers # Production is the only environment where we serve multiple versions. # def show_version_banner? - ENV['NANOC_ENV'] == 'production' && !latest? + is_production? && !latest? end # diff --git a/lib/helpers_.rb b/lib/helpers_.rb index a555e37d..9a03d513 100644 --- a/lib/helpers_.rb +++ b/lib/helpers_.rb @@ -6,3 +6,4 @@ include Nanoc::Helpers::EditOnGitLab include Nanoc::Helpers::VersionsDropdown include Nanoc::Helpers::IconsHelper include Nanoc::Helpers::ReadingTimeHelper +include Nanoc::Helpers::Generic |