diff --git a/config.example.js b/config.example.js
index f1a408e9a3..1e11478afe 100644
--- a/config.example.js
+++ b/config.example.js
@@ -33,6 +33,11 @@ config = {
// Change this to your Ghost blog's published URL.
url: 'http://localhost:2368',
+ // Example refferer policy
+ // Visit https://www.w3.org/TR/referrer-policy/ for instructions
+ // default 'origin-when-cross-origin',
+ // referrerPolicy: 'origin-when-cross-origin',
+
// Example mail config
// Visit http://support.ghost.org/mail for instructions
// ```
diff --git a/core/server/helpers/ghost_head.js b/core/server/helpers/ghost_head.js
index 3d204c0ef8..c4ba77cc43 100644
--- a/core/server/helpers/ghost_head.js
+++ b/core/server/helpers/ghost_head.js
@@ -80,14 +80,15 @@ function ghost_head(options) {
head = [],
context = this.context ? this.context[0] : null,
useStructuredData = !config.isPrivacyDisabled('useStructuredData'),
- safeVersion = this.safeVersion;
+ safeVersion = this.safeVersion,
+ referrerPolicy = config.referrerPolicy ? config.referrerPolicy : 'origin-when-cross-origin';
return getClient().then(function (client) {
if (context) {
// head is our main array that holds our meta data
head.push('');
- head.push('');
+ head.push('');
if (metaData.previousUrl) {
head.push('/);
- rendered.string.should.match(//);
+ rendered.string.should.match(//);
rendered.string.should.match(//);
rendered.string.should.match(//);
rendered.string.should.match(//);
@@ -135,7 +135,7 @@ describe('{{ghost_head}} helper', function () {
).then(function (rendered) {
should.exist(rendered);
rendered.string.should.match(//);
- rendered.string.should.match(//);
+ rendered.string.should.match(//);
rendered.string.should.match(//);
rendered.string.should.match(//);
rendered.string.should.match(//);
@@ -803,6 +803,32 @@ describe('{{ghost_head}} helper', function () {
});
});
+ describe('with changed origin in config file', function () {
+ beforeEach(function () {
+ configUtils.set({
+ url: 'http://testurl.com/blog/',
+ theme: {
+ title: 'Ghost',
+ description: 'blog description',
+ cover: '/content/images/blog-cover.png'
+ },
+ referrerPolicy: 'origin'
+ });
+ });
+
+ it('contains the changed origin', function (done) {
+ helpers.ghost_head.call(
+ {safeVersion: '0.3', context: ['paged', 'index']},
+ {data: {root: {context: []}}}
+ ).then(function (rendered) {
+ should.exist(rendered);
+ rendered.string.should.match(//);
+
+ done();
+ }).catch(done);
+ });
+ });
+
describe('with useStructuredData is set to false in config file', function () {
beforeEach(function () {
configUtils.set({