Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add redirects from old urls * old manuals are now served as stable * and unstable manuals were added * <link rel="cannonical" url=".." /> was added not to confuse search engines
- Loading branch information
Showing
10 changed files
with
375 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! /usr/bin/env bash | ||
|
||
set -e | ||
|
||
dir="$1" | ||
cannonical="$2" | ||
baseUrl="https://nixos.org/$dir/$cannonical" | ||
|
||
[[ -d $dir ]] | ||
|
||
# loop over each channel/version | ||
for path in $dir/*; do | ||
# loop over each html file | ||
(cd $path && find -type f -print) | while read htmlFile; do | ||
if [[ "$htmlFile" == *.html ]]; then | ||
fileName=${htmlFile#"./"} | ||
filePath="$path/$fileName" | ||
echo -n "Patching $filePath ..." | ||
cannonicalFileName="$dir/$cannonical/$fileName" | ||
cannonicalUrl=$baseUrl | ||
if [ -e $cannonicalFileName ]; then | ||
if [ "$fileName" != "index.html" ]; then | ||
cannonicalUrl="$baseUrl/$fileName" | ||
fi | ||
fi | ||
cannonicalTag="<link rel=\"cannonical\" url=\"$cannonicalUrl\" />" | ||
if grep -Fq "$cannonicalTag" $filePath; then | ||
echo " Already patched!" | ||
else | ||
sed -i -e "s|</head>| $cannonicalTag\n</head>|" $filePath | ||
echo " Patched!" | ||
fi | ||
fi | ||
done | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.