diff --git a/assets/_includes/about.html b/assets/_includes/about.html index 7866767..aa2da6b 100644 --- a/assets/_includes/about.html +++ b/assets/_includes/about.html @@ -12,6 +12,7 @@

About {{company.title}}

{{/if}} +{{#if hasAbouts}} {{#each presskit.abouts}}

About {{title}}

@@ -27,3 +28,4 @@

About {{title}}

{{/each}} +{{/if}} diff --git a/assets/_includes/description.html b/assets/_includes/description.html index 2638f03..37e41d5 100644 --- a/assets/_includes/description.html +++ b/assets/_includes/description.html @@ -1,12 +1,18 @@ +{{#if hasDescription}}

Description

{{rawText presskit.description}}

+{{/if}} +{{#if hasHistoryOrHistories}}

History

-{{#if presskit.history}} +{{/if}} +{{#if hasHistory}}

{{rawText presskit.history}}

{{/if}} +{{#if hasHistories}} {{#each presskit.histories}}

{{header}}

{{rawText text}}

{{/each}} +{{/if}} diff --git a/assets/_includes/factsheet.html b/assets/_includes/factsheet.html index e5d9703..4b635be 100644 --- a/assets/_includes/factsheet.html +++ b/assets/_includes/factsheet.html @@ -3,57 +3,81 @@

Factsheet

{{#if isCompany}}
+ + {{#if hasDeveloper}}
Developer:
{{presskit.title}}
+ + {{#if hasBasedIn}}
Based in {{presskit.basedIn}}
+ {{/if}} + {{/if}} + {{#if hasFoundingDate}}
Founding date:
{{presskit.foundingDate}}
+ {{/if}} + {{#if hasWebsite}}
Website:
{{prettyURL presskit.website}}
+ {{/if}} + {{#if hasPressContact}}
Press / Business contact:
{{presskit.pressContact}}
- + {{/if}} + {{#if hasSocials}}
Social:
{{#each presskit.socials}}
{{name}}
{{/each}} + {{/if}} + {{#if hasProducts}}
Releases:
{{#each products}}
{{title}}
{{/each}} + {{/if}} + {{#if hasAddresses}}
Address:
{{#each presskit.address.line}}
{{.}}
{{/each}} + {{/if}} + {{#if hasPhone}}
Phone:
{{presskit.phone}}
+ {{/if}}
{{/if}} {{#if isProduct}}
+ {{#if hasCompanyDeveloper}}
Developer:
{{company.title}}
+ {{#if hasCompanyBasedIn}}
Based in {{company.basedIn}}
+ {{/if}} + {{/if}} + {{#if hasPartners}} {{#each presskit.partners}}
{{type}}:
@@ -65,12 +89,17 @@

Factsheet

{{#if basedIn}}
Based in {{basedIn}}
{{/if}} {{/each}} + {{/if}} + + {{#if hasReleaseDates}}
Release date:
{{#each presskit.releaseDates}}
{{.}}
{{/each}} + {{/if}} + {{#if hasPlatforms}}
Platforms:
{{#each presskit.platforms}}
@@ -81,33 +110,42 @@

Factsheet

{{/if}}
{{/each}} + {{/if}} + {{#if hasWebsite}}
Website:
{{prettyURL presskit.website}}
+ {{/if}} + {{#if hasPrices}}
Regular Price:
{{#each presskit.prices}}
{{currency}} {{value}}
{{/each}} + {{/if}} + {{#if hasRelations}} {{#each presskit.relations}}
{{type}}:
{{text}}
{{/each}} + {{/if}} + {{#if hasRelationsOf}} {{#each presskit.relationOf}}
{{type}} of:
{{text}}
{{/each}} + {{/if}}
- {{#if presskit.pressCopyRequest}} + {{#if hasPressCopyRequest}}

Request Press Copy diff --git a/assets/company.html b/assets/company.html index 6eb1e77..3d9381b 100644 --- a/assets/company.html +++ b/assets/company.html @@ -21,6 +21,7 @@

{{>description}} + {{#if products}}

Projects

+ {{/if}}
diff --git a/assets/product.html b/assets/product.html index 407a68a..25433b8 100644 --- a/assets/product.html +++ b/assets/product.html @@ -20,13 +20,15 @@
{{>description}} - + {{#if hasFeatures}}

Features

+ {{/if}} +
diff --git a/lib/core/builder.js b/lib/core/builder.js index 39118d3..0b0c47c 100644 --- a/lib/core/builder.js +++ b/lib/core/builder.js @@ -67,10 +67,32 @@ async function build (dataFilePath, presskit, { // variables to differentiate a product and a company sheet. isCompany: presskit.type === 'company', isProduct: presskit.type === 'product', - - // Same to know if a presskit has any screenshots. - hasScreenshots: images.screenshots && images.screenshots.length > 0, - + // Check if a presskit has any products, addresses, screenshots, etc. + hasDeveloper: checkValidVar(presskit.title), + hasBasedIn: checkValidVar(presskit.basedIn), + hasFoundingDate: checkValidVar(presskit.foundingDate), + hasWebsite: checkValidVar(presskit.website), + hasPressContact: checkValidVar(presskit.pressContact), + hasPhone: checkValidVar(presskit.phone), + hasCompanyDeveloper: checkValidVar(company.title), + hasCompanyBasedIn: checkValidVar(company.basedIn), + hasPressCopyRequest: checkValidVar(presskit.pressCopyRequest), + hasReleaseDates: checkValidVar(presskit.releaseDates), + hasDescription: checkValidVar(presskit.description), + hasHistory: checkValidVar(presskit.history), + hasProducts: checkValidVar(presskit.product) && presskit.product.length > 0, + hasAddresses: checkValidVar(presskit.address) && presskit.address.length > 0, + hasSocials: checkValidVar(presskit.socials) && presskit.socials.length > 0, + hasScreenshots: checkValidVar(images.screenshots) && images.screenshots.length > 0, + hasPartners: checkValidVar(presskit.partners) && presskit.partners.length > 0, + hasPrices: checkValidVar(presskit.prices) && presskit.prices.length > 0, + hasPlatforms: checkValidVar(presskit.platforms) && presskit.platforms.length > 0, + hasRelations: checkValidVar(presskit.relations) && presskit.relations.length > 0, + hasRelationsOf: checkValidVar(presskit.relationOf) && presskit.relationOf.length > 0, + hasHistories: checkValidVar(presskit.histories) && presskit.histories.length > 0, + hasFeatures: checkValidVar(presskit.features) && presskit.features.length > 0, + hasAbouts: checkValidVar(presskit.abouts) && presskit.abouts.length > 0, + hasHistoryOrHistories: checkValidVar(presskit.history) || (checkValidVar(presskit.histories) && presskit.histories.length > 0), // Additional build options: hamburger: config.commands.build.hamburger, @@ -86,6 +108,11 @@ async function build (dataFilePath, presskit, { return path.relative(buildFolder, htmlFilePath) } +// Check if a var exists or it's valid +function checkValidVar (value) { + return (typeof value !== 'undefined' && value) +} + // ------------------------------------------------------------- // Folders. // -------------------------------------------------------------