/ generate-redirects
generate-redirects
 1  #!/usr/bin/env bash
 2  set -eu
 3  for fromto in \
 4    'CONTRIBUTING.md https://github.com/cirosantilli/china-dictatorship/blob/master/CONTRIBUTING.md' \
 5    'censorship.md https://github.com/cirosantilli/china-dictatorship/blob/master/censorship.md' \
 6    'communities-that-censor-politics.md https://github.com/cirosantilli/china-dictatorship/blob/master/communities-that-censor-politics.md' \
 7    'dissidents.md https://github.com/cirosantilli/china-dictatorship/blob/master/dissidents.md' \
 8    'flg-organ-harvesting= flg-organ-harvesting' \
 9    'funded- funded-by-cia' \
10    'high-mountain-and-running-river https://ourbigbook.com/cirosantilli/high-mountain-and-flowing-water' \
11    'images https://github.com/cirosantilli/china-dictatorship-media' \
12    'media.md https://github.com/cirosantilli/china-dictatorship/blob/master/media.md' \
13    'overlook-human-rights-for-profitac overlook-human-rights-for-profit' \
14    'policies.md https://github.com/cirosantilli/china-dictatorship/blob/master/policies.md' \
15    'schinese-characters-are-insane chinese-characters-are-insane' \
16    'stack-overflow-profile.md https://github.com/cirosantilli/china-dictatorship/blob/master/stack-overflow-profile.md' \
17    'stack-overflow.md stack-overflow' \
18    'white-snow-in-sunny-spring https://ourbigbook.com/cirosantilli/white-snow-in-sunny-spring' \
19  
20  do
21    from="${fromto%% *}"
22    to="${fromto#* }"
23    cat <<EOF > "out/multipage/$from.html"
24  <!DOCTYPE html>
25  <html>
26  <head>
27  <meta charset="utf-8">
28  <title>Redirecting...</title>
29  <link rel="canonical" href="$to"/>
30  <meta http-equiv="refresh" content="0;url=$to" />
31  </head>
32  <body>
33  <h1>Redirecting...</h1>
34  <a href="$to">Click here if you are not redirected.</a>
35  <script>location='$to'</script>
36  </body>
37  </html>
38  EOF
39  done