From 5add79e3d5792112d99d6780538b07cf7e0384d3 Mon Sep 17 00:00:00 2001
From: Hannah Wolfe <erisds@gmail.com>
Date: Thu, 4 Mar 2021 21:38:11 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20Portal=20not=20appearing?=
 =?UTF-8?q?=20on=20404=20pages?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

closes: https://github.com/TryGhost/Ghost/issues/12413

- portal should be included if there is no context so that it appears on 404 pages
- having this inside the if (context) block was an oversight
- we want to chain the accent color style block, so we move this to the end to make that possible
---
 core/frontend/helpers/ghost_head.js | 45 ++++++++++++++---------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/core/frontend/helpers/ghost_head.js b/core/frontend/helpers/ghost_head.js
index 70029a3313..a0e35e10c6 100644
--- a/core/frontend/helpers/ghost_head.js
+++ b/core/frontend/helpers/ghost_head.js
@@ -167,9 +167,29 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
                             '\n    </script>\n');
                     }
                 }
+            }
 
-                if (!_.includes(context, 'amp')) {
-                    head.push(getMembersHelper(options.data));
+            head.push('<meta name="generator" content="Ghost ' +
+                escapeExpression(safeVersion) + '" />');
+
+            head.push('<link rel="alternate" type="application/rss+xml" title="' +
+                escapeExpression(meta.site.title) + '" href="' +
+                escapeExpression(meta.rssUrl) + '" />');
+
+            // no code injection for amp context!!!
+            if (!_.includes(context, 'amp')) {
+                head.push(getMembersHelper(options.data));
+
+                if (!_.isEmpty(globalCodeinjection)) {
+                    head.push(globalCodeinjection);
+                }
+
+                if (!_.isEmpty(postCodeInjection)) {
+                    head.push(postCodeInjection);
+                }
+
+                if (!_.isEmpty(tagCodeInjection)) {
+                    head.push(tagCodeInjection);
                 }
             }
 
@@ -185,27 +205,6 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
                 }
             }
 
-            head.push('<meta name="generator" content="Ghost ' +
-                escapeExpression(safeVersion) + '" />');
-
-            head.push('<link rel="alternate" type="application/rss+xml" title="' +
-                escapeExpression(meta.site.title) + '" href="' +
-                escapeExpression(meta.rssUrl) + '" />');
-
-            // no code injection for amp context!!!
-            if (!_.includes(context, 'amp')) {
-                if (!_.isEmpty(globalCodeinjection)) {
-                    head.push(globalCodeinjection);
-                }
-
-                if (!_.isEmpty(postCodeInjection)) {
-                    head.push(postCodeInjection);
-                }
-
-                if (!_.isEmpty(tagCodeInjection)) {
-                    head.push(tagCodeInjection);
-                }
-            }
             debug('end');
             return new SafeString(head.join('\n    ').trim());
         })