From a0d79d596323ccc78d0095dcdb02e1bcf4cc588e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:19:12 +0100 Subject: [PATCH 01/11] Removed cv.html --- source/cv.html | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 source/cv.html diff --git a/source/cv.html b/source/cv.html deleted file mode 100644 index 6234b488..00000000 --- a/source/cv.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: https://gist.github.com/opdavies/d096d553b80140a342d4 ---- From 4b743199a957105d7354bd5f8b5606590b8eb248 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:19:31 +0100 Subject: [PATCH 02/11] Added redirects.csv --- scripts/redirects.csv | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 scripts/redirects.csv diff --git a/scripts/redirects.csv b/scripts/redirects.csv new file mode 100644 index 00000000..fbbf7cc5 --- /dev/null +++ b/scripts/redirects.csv @@ -0,0 +1,4 @@ +old,new +cv,https://gist.github.com/opdavies/d096d553b80140a342d4 +work,/ +portfolio,/ From 53882d1e01dd9255029bb7a7865e162965aeaf7f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:47:27 +0100 Subject: [PATCH 03/11] Added redirects.php --- scripts/redirects.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/redirects.php diff --git a/scripts/redirects.php b/scripts/redirects.php new file mode 100644 index 00000000..735350bd --- /dev/null +++ b/scripts/redirects.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php + + $destination, + ]; + + $output = strtr($template, $templateData); + file_put_contents("source/{$data[0]}.html", $output); + + $row++; + } +} + +fclose($handle); From 4f03c457db176a553d852ca1923693f954242539 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:54:12 +0100 Subject: [PATCH 04/11] Added redirects --- scripts/redirects.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/redirects.csv b/scripts/redirects.csv index fbbf7cc5..3abccc67 100644 --- a/scripts/redirects.csv +++ b/scripts/redirects.csv @@ -1,4 +1,5 @@ old,new +about,/ cv,https://gist.github.com/opdavies/d096d553b80140a342d4 -work,/ portfolio,/ +work,/ From 1211f0d0a547b1edfa11f21abad2a03d9ae976c6 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:54:41 +0100 Subject: [PATCH 05/11] Skip the first row, fill in the destination parameter --- scripts/redirects.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/redirects.php b/scripts/redirects.php index 735350bd..540b7323 100644 --- a/scripts/redirects.php +++ b/scripts/redirects.php @@ -17,14 +17,18 @@ $row = 1; if (($handle = fopen($filename, 'r')) !== FALSE) { while (($data = fgetcsv($handle, filesize($filename))) !== FALSE) { -var_dump($data[0]); + if ($row === 1) { + continue; + } + $templateData = [ - '%DESTINATION%' => $destination, + '%DESTINATION%' => $data[1], ]; $output = strtr($template, $templateData); file_put_contents("source/{$data[0]}.html", $output); + echo "Written to {$data[0]}.html\n"; $row++; } } From c3d6ad717b9ac6ab57402cabc0801de13161601d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 01:55:15 +0100 Subject: [PATCH 06/11] Generated redirect files --- source/about.html | 5 +++++ source/cv.html | 5 +++++ source/old.html | 5 +++++ source/portfolio.html | 5 +++++ source/work.html | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 source/about.html create mode 100644 source/cv.html create mode 100644 source/old.html create mode 100644 source/portfolio.html create mode 100644 source/work.html diff --git a/source/about.html b/source/about.html new file mode 100644 index 00000000..54f2cf78 --- /dev/null +++ b/source/about.html @@ -0,0 +1,5 @@ + +--- +layout: redirect +destination: / +--- diff --git a/source/cv.html b/source/cv.html new file mode 100644 index 00000000..ef318f1f --- /dev/null +++ b/source/cv.html @@ -0,0 +1,5 @@ + +--- +layout: redirect +destination: https://gist.github.com/opdavies/d096d553b80140a342d4 +--- diff --git a/source/old.html b/source/old.html new file mode 100644 index 00000000..e4bb9286 --- /dev/null +++ b/source/old.html @@ -0,0 +1,5 @@ + +--- +layout: redirect +destination: new +--- diff --git a/source/portfolio.html b/source/portfolio.html new file mode 100644 index 00000000..54f2cf78 --- /dev/null +++ b/source/portfolio.html @@ -0,0 +1,5 @@ + +--- +layout: redirect +destination: / +--- diff --git a/source/work.html b/source/work.html new file mode 100644 index 00000000..54f2cf78 --- /dev/null +++ b/source/work.html @@ -0,0 +1,5 @@ + +--- +layout: redirect +destination: / +--- From 12a53e9f73097de2f0d278fbf6f1ee94adb0e4bc Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 07:01:37 +0100 Subject: [PATCH 07/11] This seems to break things --- scripts/redirects.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/redirects.php b/scripts/redirects.php index 540b7323..08ff7a47 100644 --- a/scripts/redirects.php +++ b/scripts/redirects.php @@ -17,9 +17,9 @@ $row = 1; if (($handle = fopen($filename, 'r')) !== FALSE) { while (($data = fgetcsv($handle, filesize($filename))) !== FALSE) { - if ($row === 1) { - continue; - } +# if ($row == 1) { +# continue; +# } $templateData = [ '%DESTINATION%' => $data[1], @@ -29,6 +29,7 @@ if (($handle = fopen($filename, 'r')) !== FALSE) { file_put_contents("source/{$data[0]}.html", $output); echo "Written to {$data[0]}.html\n"; + $row++; } } From ff41091b95500c19e717de609530e50be8935416 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 07:03:59 +0100 Subject: [PATCH 08/11] Removed blank line from template --- scripts/redirects.php | 1 - source/about.html | 1 - source/cv.html | 1 - source/old.html | 1 - source/portfolio.html | 1 - source/work.html | 1 - 6 files changed, 6 deletions(-) diff --git a/scripts/redirects.php b/scripts/redirects.php index 08ff7a47..a2e3c760 100644 --- a/scripts/redirects.php +++ b/scripts/redirects.php @@ -3,7 +3,6 @@ Date: Fri, 7 Aug 2015 07:19:43 +0100 Subject: [PATCH 09/11] Updated redirects.php --- scripts/redirects.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts/redirects.php b/scripts/redirects.php index a2e3c760..cdc11110 100644 --- a/scripts/redirects.php +++ b/scripts/redirects.php @@ -12,24 +12,22 @@ EOS; $filename = dirname(__FILE__) . '/redirects.csv'; -$row = 1; +$row = 0; if (($handle = fopen($filename, 'r')) !== FALSE) { while (($data = fgetcsv($handle, filesize($filename))) !== FALSE) { -# if ($row == 1) { -# continue; -# } - - $templateData = [ - '%DESTINATION%' => $data[1], - ]; - - $output = strtr($template, $templateData); - file_put_contents("source/{$data[0]}.html", $output); - - echo "Written to {$data[0]}.html\n"; - $row++; + + if ($row > 1) { + $templateData = [ + '%DESTINATION%' => $data[1], + ]; + + $output = strtr($template, $templateData); + file_put_contents("source/{$data[0]}.html", $output); + + echo "Written to {$data[0]}.html\n"; + } } } From 22e36d9c41d7d614b24382ec790b5f1c19b33640 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 07:20:06 +0100 Subject: [PATCH 10/11] Removed old.html --- source/old.html | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 source/old.html diff --git a/source/old.html b/source/old.html deleted file mode 100644 index 51d73b8e..00000000 --- a/source/old.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: new ---- From 5fdc606f29ad195d815400b482860424e5e4a2bd Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 7 Aug 2015 07:31:51 +0100 Subject: [PATCH 11/11] Remove redirect pages --- source/about.html | 4 ---- source/cv.html | 4 ---- source/portfolio.html | 4 ---- source/work.html | 4 ---- 4 files changed, 16 deletions(-) delete mode 100644 source/about.html delete mode 100644 source/cv.html delete mode 100644 source/portfolio.html delete mode 100644 source/work.html diff --git a/source/about.html b/source/about.html deleted file mode 100644 index a8b03769..00000000 --- a/source/about.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: / ---- diff --git a/source/cv.html b/source/cv.html deleted file mode 100644 index 6234b488..00000000 --- a/source/cv.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: https://gist.github.com/opdavies/d096d553b80140a342d4 ---- diff --git a/source/portfolio.html b/source/portfolio.html deleted file mode 100644 index a8b03769..00000000 --- a/source/portfolio.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: / ---- diff --git a/source/work.html b/source/work.html deleted file mode 100644 index a8b03769..00000000 --- a/source/work.html +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: redirect -destination: / ----