File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 2
2
< div class ="field__icon field__icon--left flex flex--middle flex--center ">
3
3
{% include icons/symbols/search.svg %}
4
4
</ 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 %}
6
8
< input class ="field__input input DocsNav-search-input st-search-input " type ="text " placeholder ="{{ include.placeholder }} "/>
7
-
9
+ {% endif %}
8
10
{% unless include.mobile %}
9
11
< div class ="field__icon field__icon--right flex flex--middle flex--center ">
10
12
< button class ="field__button " data-ref ="search-navbar[trigger] ">
Original file line number Diff line number Diff line change 63
63
</ head >
64
64
< body >
65
65
{% 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 >
69
70
</ div >
71
+ < script >
72
+ const page = window . location . hostname ;
73
+ const regex = / (? ! ( p r e v i e w - ) ) ( \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 >
70
89
</ div >
71
90
{% endif %}
72
91
< div id ="consent-manager "> </ div >
You can’t perform that action at this time.
0 commit comments