Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
Several updates
Browse files Browse the repository at this point in the history
- Populate _data/archives.yml into the sites since that's what they use to create
the version-selection dropdown.

- Stop post-editing the generated sites since we will leverage the site archive mode
in the first place.

- Add a site-wide search engine.

- Add a robots.txt file
  • Loading branch information
mtail committed Feb 7, 2018
1 parent 28e17e2 commit 629352e
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 19 deletions.
1 change: 1 addition & 0 deletions archive.istio.io/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
istio.github.io
public/v*
firebase-debug.log
.idea
26 changes: 14 additions & 12 deletions archive.istio.io/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@
#
# Assumes you have jekyll bundle installed (one time setup
# https://github.com/istio/istio.github.io#localnative-jekyll-install
#)
#
# And you've setup firebase (npm install -g firebase-tools; firebase login)
# After running this script, push to archive.istio.io with "firebase deploy"
#

# List of name:tagOrBranch - could be read from a file too
TOBUILD=(
v0.1:release-0.1
v0.2:2863aff3e633e6047e9758be5272f894badaa259
v0.3:12577b7bba1de2f7265b0db7041192a7e04c10ce
v0.4:4eeb1699fd464522a2b6dfe64e1fd404a2530ce1
v0.2:release-0.2
v0.3:release-0.3
v0.4:release-0.4
v0.5:master
)

echo "archives:" > archives.yml
for rel in "${TOBUILD[@]}"
do
NAME=$(echo $rel | cut -d : -f 1)
echo " -" $NAME >> archives.yml
done

GITDIR=istio.github.io

if [ -d $GITDIR ]; then
Expand All @@ -28,7 +35,6 @@ else
cd $GITDIR
fi

FILESTOPATCH=(_includes/nav.html _includes/header.html _layouts/base.html index.html)
rm ../public/versions.txt 2> /dev/null
for rel in "${TOBUILD[@]}"
do
Expand All @@ -40,18 +46,14 @@ do
git checkout $TAG
git pull 2> /dev/null
echo "baseurl: /$NAME" > config_override.yml
for f in "${FILESTOPATCH[@]}"
do
mv $f $f.orig 2> /dev/null && \
( grep -v "include search-box.html" $f.orig |
sed -e "s/>Istio/>Istio <span style='font-size: 0.6em;'>Archive $NAME<\/span>/" -e "s/UA-98480406-1/UA-98480406-2/g" > $f ) && \
echo "*** Succesfully patched $f for $NAME"
done
cp ../archives.yml _data
bundle install
bundle exec jekyll build --config _config.yml,config_override.yml
git checkout -- .
git clean -f
rm -rf ../public/$NAME
mv _site ../public/$NAME
echo $NAME >> ../public/versions.txt
done
rm ../archives.yml
echo "All done!"
16 changes: 13 additions & 3 deletions archive.istio.io/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,23 @@
<link rel="stylesheet" href="/v0.5/css/all.css">
</head>

<body class="language-unknown">
<body>

<header role="banner">
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
<a class="navbar-brand d-flex w-50 mr-auto" href="/" style="visibility: visible">
<img class="logo" src="/v0.5/img/istio-logo.svg" alt="Istio Logo"/>
<span class="brand-name">Istio</span>
<span class="archive">&nbsp;Archives</span>
<span class="brand-name">Istioldies</span>
</a>
<form name="cse" id="searchbox" class="form-inline justify-content-end" role="search">
<input type="hidden" name="cx" value="013699703217164175118:iwwf17ikgf4" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="en" />
<div class="input-group">
<input name="q" class="form-control search-box" type="text" size="30" />
<button class="btn btn-search input-group-addon my-2 my-sm-0 fa fa-search" type="submit"></button>
</div>
</form>
</nav>
</header>

Expand All @@ -63,5 +71,7 @@
integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"
integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="https://www.google.com/cse/brand?form=searchbox"></script>
<script src="https://archive.istio.io/misc.js"></script>
</body>
</html>
17 changes: 13 additions & 4 deletions archive.istio.io/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,23 @@
<link rel="stylesheet" href="./v0.5/css/all.css">
</head>

<body class="language-unknown">
<body>

<header role="banner">
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
<a class="navbar-brand d-flex w-50 mr-auto" href="/" style="visibility: visible">
<img class="logo" src="./v0.5/img/istio-logo.svg" alt="Istio Logo"/>
<span class="brand-name">Istio</span>
<span class="archive">&nbsp;Archives</span>
<span class="brand-name">Istioldies</span>
</a>
<form name="cse" id="searchbox" class="form-inline justify-content-end" role="search">
<input type="hidden" name="cx" value="013699703217164175118:iwwf17ikgf4" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="en" />
<div class="input-group">
<input name="q" class="form-control search-box" type="text" size="30" />
<button class="btn btn-search input-group-addon my-2 my-sm-0 fa fa-search" type="submit"></button>
</div>
</form>
</nav>
</header>

Expand Down Expand Up @@ -89,6 +97,7 @@ <h1>istio.io archives</h1>
integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"
integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

<script src="https://www.google.com/cse/brand?form=searchbox"></script>
<script src="https://archive.istio.io/misc.js"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions archive.istio.io/public/misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@



"use strict"

function doSearch() {
var url = '/search?q=' + document.getElementsByName('q')[0].value;
window.location.assign(url);
}

$(function ($) {
$(document).ready(function() {
$('.btn-search').on('click', function(e) {
e.preventDefault();
doSearch();
});

// toggle sidebar on/off
$('[data-toggle="offcanvas"]').on('click', function () {
$('.row-offcanvas').toggleClass('active')
$(this).children('i.fa').toggleClass('fa-chevron-right');
$(this).children('i.fa').toggleClass('fa-chevron-left');
})

// toggle category tree in sidebar
$(document).on('click', '.tree-toggle', function () {
$(this).children('i.fa').toggleClass('fa-caret-right');
$(this).children('i.fa').toggleClass('fa-caret-down');
$(this).parent().children('ul.tree').toggle(200);
});
});
}(jQuery));
2 changes: 2 additions & 0 deletions archive.istio.io/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow:
117 changes: 117 additions & 0 deletions archive.istio.io/public/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en" itemscope itemtype="https://schema.org/WebPage">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="title" content="Search Results">
<meta name="og:title" content="Search Results">
<meta name="og:image" content="./v0.5/img/logo.png"/>
<meta name="theme-color" content="#466BB0"/>
<meta name="description" content="Search Results.">
<meta name="og:description" content="Search Results.">

<title>Search Results</title>

<link rel="shortcut icon" href="./v0.5/favicons/favicon.ico">
<link rel="apple-touch-icon" href="./v0.5/favicons/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="icon" type="image/png" href="./v0.5/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="./v0.5/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-36x36.png" sizes="36x36">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-48x48.png" sizes="48x48">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-72x72.png" sizes="72x72">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-96x196.png" sizes="96x196">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-144x144.png" sizes="144x144">
<link rel="icon" type="image/png" href="./v0.5/favicons/android-192x192.png" sizes="192x192">

<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"
integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./v0.5/css/all.css">
</head>

<body>

<header role="banner">
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
<a class="navbar-brand d-flex w-50 mr-auto" href="/" style="visibility: visible">
<img class="logo" src="./v0.5/img/istio-logo.svg" alt="Istio Logo"/>
<span class="brand-name">Istioldies</span>
</a>

<form name="cse" id="searchbox" class="form-inline justify-content-end" role="search">
<input type="hidden" name="cx" value="013699703217164175118:iwwf17ikgf4" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="en" />
<div class="input-group">
<input name="q" class="form-control search-box" type="text" size="30" />
<button class="btn btn-search input-group-addon my-2 my-sm-0 fa fa-search" type="submit"></button>
</div>
</form>
</nav>
</header>

<style>
.gsc-table-cell-snippet-close, .gsc-table-cell-snippet-open {
padding: 6px;
}

td {
border: 0;
}

table {
border: 0;
}
</style>

<div class="container-fluid search-results">
<div class="row">
<div class="col-12 col-md-1"></div>
<div class="col-12 col-md-10">
<main role="main">
<script>
(function () {
var cx = '013699703217164175118:iwwf17ikgf4';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
</main>
</div>
<div class="col-12 col-md-1"></div>
</div>
</div>

<script>
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var q = getParameterByName('q', window.location.href);
document.getElementsByName('q')[0].value = q;
</script>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"
integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"
integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="https://www.google.com/cse/brand?form=searchbox"></script>
<script src="https://archive.istio.io/misc.js"></script>
</body>
</html>

1 comment on commit 629352e

@ldemailly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was #44 ...

Please sign in to comment.