diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:39:20 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-06-02 13:39:20 +0300 |
commit | e7d79376ae2c0c6fdca76bea38498178999374ad (patch) | |
tree | f5905efaca99efabd63726883b53d3b0eef3c822 | |
parent | f539f568545c608f329a0ffaa3031f674529b5c1 (diff) | |
parent | 8151351168d4a7955dadd208b74977886daa81e5 (diff) |
Merge branch 'cherry-pick-69942af7-15.0' into '15.0'15.0
Load the analytics only in the main site (15.0 backport)
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3911
Merged-by: Achilleas Pipinellis <axil@gitlab.com>
Reviewed-by: Achilleas Pipinellis <axil@gitlab.com>
Co-authored-by: Sarah German <sgerman@gitlab.com>
-rw-r--r-- | .gitlab-ci.yml | 124 | ||||
-rw-r--r-- | layouts/404.html | 5 | ||||
-rw-r--r-- | layouts/analytics.html | 2 | ||||
-rw-r--r-- | layouts/default.html | 5 | ||||
-rw-r--r-- | layouts/gtm.html | 2 | ||||
-rw-r--r-- | layouts/head.html | 16 | ||||
-rw-r--r-- | layouts/home.html | 4 | ||||
-rw-r--r-- | layouts/instantsearch.html | 4 |
8 files changed, 78 insertions, 84 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71e1c2fd..bbcfce08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -432,72 +432,72 @@ lint_dockerfiles: # # Deploy the Review App on a dev server # -review: - stage: deploy - extends: - - .retry - variables: - GIT_STRATEGY: none - needs: - - compile_dev - before_script: [] - cache: {} - script: - # Rsync to the Pages dir - - rsync -av --delete public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - # Remove public directory so that the next review app can run in a - # clean environment (limitation of the shell executor). - - rm -rf public - environment: - name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - url: http://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.$APPS_DOMAIN - on_stop: review_stop - rules: - - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' - when: manual - - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' - when: never - - if: '$CI_MERGE_REQUEST_ID' - - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"' - - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch - tags: - - nginx - - review-apps +#review: +# stage: deploy +# extends: +# - .retry +# variables: +# GIT_STRATEGY: none +# needs: +# - compile_dev +# before_script: [] +# cache: {} +# script: +# # Rsync to the Pages dir +# - rsync -av --delete public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# # Remove public directory so that the next review app can run in a +# # clean environment (limitation of the shell executor). +# - rm -rf public +# environment: +# name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# url: http://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.$APPS_DOMAIN +# on_stop: review_stop +# rules: +# - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' +# when: manual +# - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' +# when: never +# - if: '$CI_MERGE_REQUEST_ID' +# - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"' +# - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch +# tags: +# - nginx +# - review-apps # # Stop the Review App # -review_stop: - stage: deploy - extends: - - .retry - variables: - GIT_STRATEGY: none - needs: [] - artifacts: {} - before_script: [] - cache: {} - script: - - rm -rf public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - environment: - name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG - action: stop - rules: - - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' - allow_failure: true - when: manual - - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' - when: never - - if: '$CI_MERGE_REQUEST_ID || $CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"' - allow_failure: true - when: manual - # TODO: Remove once no projects create such branch - - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' - allow_failure: true - when: manual - tags: - - nginx - - review-apps +#review_stop: +# stage: deploy +# extends: +# - .retry +# variables: +# GIT_STRATEGY: none +# needs: [] +# artifacts: {} +# before_script: [] +# cache: {} +# script: +# - rm -rf public /srv/nginx/pages/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# environment: +# name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG +# action: stop +# rules: +# - if: '$CI_PROJECT_PATH == "gitlab-renovate-forks/gitlab-docs"' +# allow_failure: true +# when: manual +# - if: '$CI_PROJECT_PATH !~ /^gitlab-org/' +# when: never +# - if: '$CI_MERGE_REQUEST_ID || $CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"' +# allow_failure: true +# when: manual +# # TODO: Remove once no projects create such branch +# - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' +# allow_failure: true +# when: manual +# tags: +# - nginx +# - review-apps # # Clean up review apps and free disk space diff --git a/layouts/404.html b/layouts/404.html index 525641a4..023cab13 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -20,9 +20,8 @@ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js" integrity="sha384-LtrjvnR4Twt/qOuYxE721u19sVFLVSA4hf/rRt6PrZTmiPltdZcI7q7PXQBYTKyf" crossorigin="anonymous"></script> <script src="<%= @items['/frontend/404/404.*'].path %>"></script> <%= render '/docsearch.*' %> - <% if production? %> + <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> </body> </html> diff --git a/layouts/analytics.html b/layouts/analytics.html index 3f8a9985..f18097f5 100644 --- a/layouts/analytics.html +++ b/layouts/analytics.html @@ -1,3 +1,4 @@ +<% if production_and_default_branch? %> <!-- Facebook --> <script src="<%= @items['/assets/javascripts/facebook_analytics.*'].path %>"></script> <noscript><img height="1" width="1" style="display:none" @@ -19,3 +20,4 @@ src="https://www.facebook.com/tr?id=1689559637958103&ev=PageView&noscript=1" <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=30694&fmt=gif" /> </noscript> +<% end %> diff --git a/layouts/default.html b/layouts/default.html index 49da148d..7acf01d9 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -101,10 +101,9 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <%= render '/docsearch.*' %> <script src="<%= @items['/assets/javascripts/mermaid.*'].path %>"></script> - <% if production? %> + <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/assets/javascripts/docs.*'].path %>"></script> <script src="<%= @items['/assets/javascripts/global-nav.*'].path %>"></script> diff --git a/layouts/gtm.html b/layouts/gtm.html index 87ebf4cb..bf124396 100644 --- a/layouts/gtm.html +++ b/layouts/gtm.html @@ -1,4 +1,4 @@ -<% if production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> +<% if production_and_default_branch? %> <%# 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 c36d15ad..3909a3fd 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -43,19 +43,17 @@ <!-- end of docsearch --> <% if production? %> - <%# Adds GTM only in production %> - <!-- add cookie consent --> - <script type="text/javascript" src="https://cdn.cookielaw.org/consent/7f944245-c5cd-4eed-a90e-dd955adfdd08/OtAutoBlock.js"> - </script> - - <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="7f944245-c5cd-4eed-a90e-dd955adfdd08"> - </script> - + <!-- OneTrust Cookies Consent Notice start --> + <script src="https://cdn.cookielaw.org/consent/7f944245-c5cd-4eed-a90e-dd955adfdd08/OtAutoBlock.js"></script> + <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" charset="UTF-8" data-domain-script="7f944245-c5cd-4eed-a90e-dd955adfdd08"></script> <script type="text/javascript"> function OptanonWrapper() { } </script> + <!-- OneTrust Cookies Consent Notice end --> +<% end %> - +<% if production_and_default_branch? %> + <%# Adds GTM only in production %> <!-- Google Tag Manager --> <script src="<%= @items['/assets/javascripts/google_tagmanager.*'].path %>"></script> <!-- End Google Tag Manager --> diff --git a/layouts/home.html b/layouts/home.html index 2966b363..dad52401 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -9,10 +9,8 @@ <%= render '/header.*' %> <%= yield %> <%= render '/docsearch.*' %> - <% if production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> diff --git a/layouts/instantsearch.html b/layouts/instantsearch.html index 717cdb0a..8a522748 100644 --- a/layouts/instantsearch.html +++ b/layouts/instantsearch.html @@ -23,10 +23,8 @@ <script type="application/javascript" src="<%= @items['/assets/javascripts/badges.*'].path %>"></script> <script src="<%= @items['/frontend/header/index.*'].path %>"></script> <script src="<%= @items['/frontend/search/index.*'].path %>"></script> - <% if production? %> <%# Add analytics only in production %> - <%= render '/analytics.*' %> - <% end %> + <%= render '/analytics.*' %> <%= render '/schema-microdata.*' %> </body> </html> |