Skip to content

Commit

Permalink
Merge pull request #52 from Financial-Times/CPREL-708
Browse files Browse the repository at this point in the history
Revert "CPREL-708: Remove Product from structured data type to prevent errors in Semrush"
  • Loading branch information
AliceArmstrong authored Sep 13, 2023
2 parents 11968cf + f8bd54f commit d1476b3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Included in the JSON-LD (but not the snippet below) is a whole load of other met
[...]
'isAccessibleForFree': 'False',
'isPartOf': {
'@type': [ 'CreativeWork' ],
'@type': [ 'CreativeWork', 'Product' ],
'name' : 'Financial Times',
'productID': 'ft.com:subscribed' // or 'ft.com:premium' or 'ft.com:registered' depending on the requested content accessLevel
}
Expand All @@ -66,7 +66,7 @@ SwG would automatically fetch all our SKUs on a free page (which is what you wou
[...]
'isAccessibleForFree': 'True',
'isPartOf': {
'@type': [ 'CreativeWork' ],
'@type': [ 'CreativeWork', 'Product' ],
'name' : 'Financial Times',
'productID': 'ft.com:free'
}
Expand All @@ -81,7 +81,7 @@ Content barriers populate the `isPartOf` markup with data pertaining to the requ
'@context': 'http://schema.org',
'isAccessibleForFree': 'False',
'isPartOf': {
'@type': [ 'CreativeWork' ],
'@type': [ 'CreativeWork', 'Product' ],
'name' : 'Financial Times',
'productID': 'ft.com:subscribed' // or 'ft.com:premium' or 'ft.com:registered' depending on the requested content accessLevel
}
Expand Down
2 changes: 1 addition & 1 deletion test/types/article.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Type: Article', function () {
expect(result.isAccessibleForFree).to.equal('False');
expect(result['@type']).to.equal('NewsArticle');
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
expect(result.publisher).to.contain({
Expand Down
8 changes: 4 additions & 4 deletions test/types/barrier.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Type: Barrier', function () {
expect(result.isAccessibleForFree).to.be.undefined;
expect(result['@type']).to.equal('CreativeWork');
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
expect(result.publisher).to.contain({
Expand All @@ -29,7 +29,7 @@ describe('Type: Barrier', function () {
expect(result.isAccessibleForFree).to.be.undefined;
expect(result['@type']).to.equal('CreativeWork');
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
expect(result.publisher).to.contain({
Expand All @@ -43,7 +43,7 @@ describe('Type: Barrier', function () {
const result = barrier(mergeWithArticle({ accessLevel: 'free' }));
expect(result['@type']).to.equal('NewsArticle');
expect(result.isAccessibleForFree).to.equal('True');
expect(result.isPartOf['@type']).to.eql(['CreativeWork']);
expect(result.isPartOf['@type']).to.eql(['CreativeWork', 'Product']);
expect(result.isPartOf).to.contain({
name: 'Financial Times',
productID: 'ft.com:free'
Expand All @@ -60,7 +60,7 @@ describe('Type: Barrier', function () {
expect(result['@type']).to.equal('NewsArticle');
expect(result.isAccessibleForFree).to.equal('False');
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/types/liveblog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Type: liveBlogPosting', function () {
'coverageEndTime'
]);
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
expect(result.publisher).to.contain({
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Type: liveBlogPosting', function () {
expect(result.isAccessibleForFree).to.equal('False');
expect(result['@type']).to.equal('LiveBlogPosting');
expect(result.isPartOf).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'Financial Times'
});
expect(result.publisher).to.contain({
Expand Down
4 changes: 2 additions & 2 deletions test/types/product.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ describe('Type: Product', function () {
it('has correct base format', function () {
const result = product(mockCompany, {});
expect(result).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'ft'
});
});

it('wont add productID entitlements label if no matching content.accessLevel', function () {
const result = product(mockCompany, { accessLevel: 'foo' });
expect(result).to.deep.equal({
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: 'ft'
});
});
Expand Down
2 changes: 1 addition & 1 deletion types/product.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = (company = {}, content = {}) => {
const baseSchema = {
'@type': ['CreativeWork'],
'@type': ['CreativeWork', 'Product'],
name: company.prefLabel
};

Expand Down

0 comments on commit d1476b3

Please sign in to comment.