Skip to content

Commit dcbcb4f

Browse files
authored
Merge branch 'master' into kotlin/android-docs
2 parents 4e95132 + e5a1303 commit dcbcb4f

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/_includes/navbar/search.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<div class="field__icon field__icon--left flex flex--middle flex--center">
33
{% include icons/symbols/search.svg %}
44
</div>
5-
5+
{% if jekyll.environment == "testing" %}
6+
<input class="field__input input DocsNav-search-input st-search-input" disabled type="text" placeholder="Search disabled for previews"/>
7+
{% else %}
68
<input class="field__input input DocsNav-search-input st-search-input" type="text" placeholder="{{ include.placeholder }}"/>
7-
9+
{% endif %}
810
{% unless include.mobile %}
911
<div class="field__icon field__icon--right flex flex--middle flex--center">
1012
<button class="field__button" data-ref="search-navbar[trigger]">

src/_layouts/default.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,29 @@
6363
</head>
6464
<body>
6565
{% if jekyll.environment == "testing" %}
66-
<div style="height:30px; background-color:#fbfb81; width:100%; border-bottom: 1px solid #888">
67-
<div class="stage">
68-
<p>This site is meant for preview only. Please do not share outside of Segment. Search results link directly to production.</p>
66+
<!-- This section displays on Netlify only -->
67+
<div style="height:30px; background-color:#fbfb81; width:100%; border-bottom: 1px solid #888; position: sticky; top:0; z-index: 1000;">
68+
<div class="stage" style="min-height: 30px;">
69+
<p>This site is meant for preview only. Please do not share outside of Segment.<span id="ghtext"> This page previews pull request <strong><a id="ghlink" href="" target="_blank"></a></strong></span></p>
6970
</div>
71+
<script>
72+
const page = window.location.hostname;
73+
const regex = /(?!(preview-))(\d+)/g;
74+
var span = document.getElementById("ghtext");
75+
const found = page.match(regex);
76+
const gh_base = "https://github.com/segmentio/segment-docs/pull/"
77+
78+
if (found == null) {
79+
span.style.display = "none";
80+
} else {
81+
const pr = found[0]
82+
const full_url = gh_base.concat(pr);
83+
const link = document.getElementById("ghlink");
84+
85+
link.href = full_url;
86+
link.innerHTML = pr;
87+
}
88+
</script>
7089
</div>
7190
{% endif %}
7291
<div id="consent-manager"></div>

0 commit comments

Comments
 (0)