commit 4afb9a691ceedfe4f3ab137933915374a64ab764 Author: Katharina Irrgang Date: Mon Feb 6 15:32:40 2017 +0100 ✨ feature: define redirects in a custom file (#7719) (#7945) refs #7707 - be able to add a custom redirect file into the content folder - define redirects as JSON format The redirects feature is already present in the LTS branch. I was not able to cherry-pick over, too many changes or conflicts. Creating a PR to ensure 1. tests pass and 2. overview of code changes. I had to add an example active theme to our test fixture utils, because otherwise Ghost will complain when forking Ghost. diff --git a/ghost/zip/test/fixtures/test-theme/LICENSE b/ghost/zip/test/fixtures/test-theme/LICENSE new file mode 100644 index 0000000000..97a642728b --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013-2016 Ghost Foundation + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/ghost/zip/test/fixtures/test-theme/README.md b/ghost/zip/test/fixtures/test-theme/README.md new file mode 100644 index 0000000000..1d787f50dd --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/README.md @@ -0,0 +1,16 @@ +# Casper + +The default theme for [Ghost](http://github.com/tryghost/ghost/). + +To download, visit the [releases](https://github.com/TryGhost/Casper/releases) page. + +## Copyright & License + +Copyright (c) 2013-2016 Ghost Foundation - Released under the MIT License. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ghost/zip/test/fixtures/test-theme/author.hbs b/ghost/zip/test/fixtures/test-theme/author.hbs new file mode 100644 index 0000000000..eb7b1de741 --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/author.hbs @@ -0,0 +1,41 @@ +{{!< default}} +{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}} + +{{!-- The big featured header --}} + +{{!-- Everything inside the #author tags pulls data from the author --}} +{{#author}} +
+ +
+ +
+ {{#if image}} +
+
+
+ {{/if}} +

{{name}}

+ {{#if bio}} +

{{bio}}

+ {{/if}} +
+ {{#if location}}{{location}}{{/if}} + {{#if website}}{{website}}{{/if}} + {{plural ../pagination.total empty='No posts' singular='% post' plural='% posts'}} +
+
+{{/author}} + +{{!-- The main content area on the homepage --}} +
+ + {{!-- The tag below includes the post loop - partials/loop.hbs --}} + {{> "loop"}} + +
diff --git a/ghost/zip/test/fixtures/test-theme/default.hbs b/ghost/zip/test/fixtures/test-theme/default.hbs new file mode 100644 index 0000000000..a3602a5193 --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/default.hbs @@ -0,0 +1,54 @@ + + + + {{!-- Document Settings --}} + + + + {{!-- Page Meta --}} + {{meta_title}} + + + {{!-- Mobile Meta --}} + + + + {{!-- Brand icon --}} + + + {{!-- Styles'n'Scripts --}} + + + + {{!-- Ghost outputs important style and meta data with this tag --}} + {{ghost_head}} + + + + {{!-- The blog navigation links --}} + {{navigation}} + +
+ + {{!-- All the main content gets inserted here, index.hbs, post.hbs, etc --}} + {{{body}}} + + {{!-- The tiny footer at the very bottom --}} + + +
+ + {{!-- jQuery needs to come before `{{ghost_foot}}` so that jQuery can be used in code injection --}} + + {{!-- Ghost outputs important scripts and data with this tag --}} + {{ghost_foot}} + {{!-- Fitvids makes video embeds responsive and awesome --}} + + {{!-- The main JavaScript file for Casper --}} + + + + diff --git a/ghost/zip/test/fixtures/test-theme/index.hbs b/ghost/zip/test/fixtures/test-theme/index.hbs new file mode 100644 index 0000000000..8ca878095b --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/index.hbs @@ -0,0 +1,27 @@ +{{!< default}} +{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}} + +{{!-- The big featured header --}} +
+ +
+
+

{{@blog.title}}

+

{{@blog.description}}

+
+
+ +
+ +{{!-- The main content area on the homepage --}} +
+ + {{!-- The tag below includes the post loop - partials/loop.hbs --}} + {{> "loop"}} + +
diff --git a/ghost/zip/test/fixtures/test-theme/package.json b/ghost/zip/test/fixtures/test-theme/package.json new file mode 100644 index 0000000000..fb158a3f8f --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/package.json @@ -0,0 +1,4 @@ +{ + "name": "Casper", + "version": "1.3.1" +} diff --git a/ghost/zip/test/fixtures/test-theme/page.hbs b/ghost/zip/test/fixtures/test-theme/page.hbs new file mode 100644 index 0000000000..9bea823946 --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/page.hbs @@ -0,0 +1,31 @@ +{{!< default}} + +{{!-- This is a page template. A page outputs content just like any other post, and has all the same + attributes by default, but you can also customise it to behave differently if you prefer. --}} + +{{!-- Everything inside the #post tags pulls data from the page --}} +{{#post}} + +
+ +
+ +
+
+ +
+

{{title}}

+
+ +
+ {{content}} +
+ +
+
+{{/post}} diff --git a/ghost/zip/test/fixtures/test-theme/partials/loop.hbs b/ghost/zip/test/fixtures/test-theme/partials/loop.hbs new file mode 100644 index 0000000000..0aa02976a5 --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/partials/loop.hbs @@ -0,0 +1,25 @@ +{{!-- Previous/next page links - only displayed on page 2+ --}} +
+ {{pagination}} +
+ +{{!-- This is the post loop - each post will be output using this markup --}} +{{#foreach posts}} +
+
+

{{title}}

+
+
+

{{excerpt words="26"}} »

+
+
+ {{#if author.image}}{{author.name}}{{/if}} + {{author}} + {{tags prefix=" on "}} + +
+
+{{/foreach}} + +{{!-- Previous/next page links - displayed on every page --}} +{{pagination}} diff --git a/ghost/zip/test/fixtures/test-theme/partials/navigation.hbs b/ghost/zip/test/fixtures/test-theme/partials/navigation.hbs new file mode 100644 index 0000000000..be377d569e --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/partials/navigation.hbs @@ -0,0 +1,17 @@ + + diff --git a/ghost/zip/test/fixtures/test-theme/post.hbs b/ghost/zip/test/fixtures/test-theme/post.hbs new file mode 100644 index 0000000000..5d85551e62 --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/post.hbs @@ -0,0 +1,110 @@ +{{!< default}} + +{{!-- The comment above "< default" means - insert everything in this file into + the {{{body}}} of the default.hbs template, containing the blog header/footer. --}} + +{{!-- Everything inside the #post tags pulls data from the post --}} +{{#post}} + +
+ +
+ +
+
+ +
+

{{title}}

+ +
+ +
+ {{content}} +
+ +
+ + {{!-- Everything inside the #author tags pulls data from the author --}} + {{#author}} + + {{#if image}} +
+ +
+ {{/if}} + +
+

{{name}}

+ + {{#if bio}} +

{{bio}}

+ {{else}} +

Read more posts by this author.

+ {{/if}} +
+ {{#if location}}{{location}}{{/if}} + {{#if website}}{{website}}{{/if}} +
+
+ + {{/author}} + + + + {{!-- Email subscribe form at the bottom of the page --}} + {{#if @labs.subscribers}} +
+

Subscribe to {{@blog.title}}

+

Get the latest posts delivered right to your inbox.

+ {{subscribe_form placeholder="Your email address"}} + or subscribe via RSS with Feedly! +
+ {{/if}} + +
+ +
+
+ +{{!-- Links to Previous/Next posts --}} + + +{{/post}} diff --git a/ghost/zip/test/fixtures/test-theme/tag.hbs b/ghost/zip/test/fixtures/test-theme/tag.hbs new file mode 100644 index 0000000000..0ed7187efc --- /dev/null +++ b/ghost/zip/test/fixtures/test-theme/tag.hbs @@ -0,0 +1,34 @@ +{{!< default}} +{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}} + +{{!-- If we have a tag cover, display that - else blog cover - else nothing --}} +
+ +
+ {{#tag}} +
+

{{name}}

+

+ {{#if description}} + {{description}} + {{else}} + A {{../pagination.total}}-post collection + {{/if}} +

+
+ {{/tag}} +
+
+ +{{!-- The main content area on the homepage --}} +
+ + {{!-- The tag below includes the post loop - partials/loop.hbs --}} + {{> "loop"}} + +