Skip to content

Commit

Permalink
Merge pull request #696 from Shinsina/staging-super-category
Browse files Browse the repository at this point in the history
Super Category Pages STAGING
  • Loading branch information
Shinsina authored May 28, 2024
2 parents d4256eb + 279976d commit 272d784
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 7 deletions.
7 changes: 3 additions & 4 deletions packages/global/components/leaders/taxonomy-page.marko
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
$ const { site, req } = out.global;
$ const { sectionIds } = input;

<if(sectionIds && site.get("leaders.enabled"))>
<if(site.get("leaders.enabled"))>
<marko-web-leaders props={
sectionIds: sectionIds,
open: "auto",
iconStyle: "chevron",
sectionAlias: site.get("leaders.alias"),
Expand All @@ -16,6 +14,7 @@ $ const { sectionIds } = input;
calloutPrefix: site.get("leaders.calloutPrefix") || "Browse these",
calloutValue: site.get("leaders.calloutValue") || "leading suppliers",
viewAllText: site.get("leaders.viewAllText") || "View All Companies &gt;",
contextual: true
contextual: true,
expanded: false,
}/>
</if>
6 changes: 6 additions & 0 deletions packages/global/config/gam.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ module.exports = ({
{ viewport: [980, 0], size: [300, 250] },
{ viewport: [0, 0], size: [] },
],
})
.setTemplate('NATIVE', {
size: ['fluid'],
sizeMapping: [
{ viewport: [0, 0], size: ['fluid'] },
],
});

return config;
Expand Down
163 changes: 163 additions & 0 deletions packages/global/templates/website-section/super-category.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import hierarchyAliases from "@parameter1/base-cms-marko-web/utils/hierarchy-aliases";
import convertAdToNode from "@parameter1/base-cms-marko-web-native-x/utils/convert-ad-to-node";
import { getAsArray } from "@parameter1/base-cms-object-path";
import queryFragment from "@parameter1/base-cms-marko-web-theme-monorail/graphql/fragments/section-feed-block";

$ const {
id,
alias,
name,
pageNode,
description,
} = input;
$ const {
site,
GAM,
req,
i18n,
nativeX: nxConfig,
pagination: p
} = out.global;
$ const perPage = 12;
$ const continueLabel = i18n("Sign Me Up!");
$ const loginEmailLabel = i18n("Work Email");
$ const actionText = i18n("signing up to receive your email notifications");
$ const buttonLabels = { continue: continueLabel };
$ const effectiveAdAlias = alias.split('/')[0];

$ const queryParams = {
limit: perPage,
skip: p.skip({ perPage, skip: 1 }),
sectionAlias: alias,
excludeContentTypes: ['Product'],
queryFragment,
};

<global-website-section-default-layout
id=id
alias=alias
name=name
page-node=pageNode
>
<@section|{ aliases }| modifiers=["first"]>
<theme-gam-define-display-ad
name=`leaderboard-${effectiveAdAlias}`
position="section_page"
aliases=aliases
modifiers=["inter-block"]
/>
</@section>

<@section|{ blockName, aliases }|>
<div class="row">
<div class="col-lg-8">
$ const pinnedParams = {
limit: 1,
skip: p.skip({ perPage }),
sectionAlias: alias,
excludeContentTypes: ['Product'],
queryFragment,
}
<marko-web-query|{ nodes }| name="website-scheduled-content" params=pinnedParams>
$ const pinnedNode = nodes.slice(0, 1)[0] || {};
$ const { id, type, siteContext, primaryImage } = pinnedNode;
$ const pinnedImageNode = {
id,
type,
siteContext,
primaryImage
};
<marko-web-element block-name="top-stories" name="row">
<marko-web-element block-name="top-stories" name="col" modifiers=["hero"]>
<theme-content-node
image-position="top"
card=true
flush=true
image-only=true
modifiers=["top-stories-hero-image"]
node=pinnedImageNode
>
<@image fluid=true width=600 ar="3:2" lazyload=false />
</theme-content-node>
</marko-web-element>
<marko-web-element block-name="top-stories" name="col" modifiers=["list"]>
<theme-content-node
full-height=true
card=true
display-image=false
flush=true
modifiers=["top-stories-hero"]
node=pinnedNode
/>
</marko-web-element>
</marko-web-element>
</marko-web-query>
<marko-web-website-section-name|{ value }|
tag="h1"
block-name=blockName
obj={ name }
attrs={ style: "padding-top: 20px" }
>
<if(p.page > 1)>${value}: ${i18n("Page")} ${p.page}</if>
<else>${value}</else>
</marko-web-website-section-name>
<marko-web-query|{ nodes }| name="website-scheduled-content" params=queryParams>
<marko-web-node-list
flush-x=true
flush-y=false
modifiers=["section-feed"]
>
<@nodes nodes=nodes>
<@slot|{ node, index }|>
<theme-section-feed-content-node node=node />
<if(index === 2)>
<theme-gam-define-display-ad
name=`inline-content-left-${effectiveAdAlias}`
aliases=aliases
position="section_page"
/>
</if>
</@slot>
</@nodes>
</marko-web-node-list>
</marko-web-query>
<theme-query-total-count|{ totalCount }| name="website-scheduled-content" params={ sectionAlias: alias }>
<theme-pagination-controls
per-page=perPage
total-count=totalCount
path=req.path
/>
</theme-query-total-count>
</div>
<div class="col-lg-4">
<marko-web-identity-x-context|{ hasUser }|>
<if(!hasUser)>
<identity-x-newsletter-form-inline
button-labels=buttonLabels
login-email-label=loginEmailLabel
login-email-placeholder="[email protected]"
type="inlineSection"
action-text=actionText
with-image=false
/>
</if>
</marko-web-identity-x-context>
<div class="node-list node-list--flush-x py-3" >
<if(site.get("leaders.enabled"))>
<global-leaders-taxonomy-page />
</if>
<theme-gam-define-display-ad
name=`inline-content-right-${effectiveAdAlias}`
aliases=aliases
position="section_page"
/>
<theme-gam-define-display-ad
name=`rotation-${effectiveAdAlias}`
aliases=aliases
position="section_page"
/>
</div>
</div>
</div>
</@section>
</global-website-section-default-layout>
26 changes: 24 additions & 2 deletions sites/packworld.com/config/gam.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,30 @@ config.setAliasAdUnits('default', [
{ name: 'inline-content', templateName: 'INLINE-CONTENT', path: 'rotation' },
{ name: 'inline-content-mobile', templateName: 'INLINE-CONTENT-MOBILE', path: 'rotation' },
{ name: 'inline-content-desktop', templateName: 'INLINE-CONTENT-DESKTOP', path: 'rotation' },
{ name: 'wallpaper-left', templateName: 'WALLPAPER', path: 'wallpaper-left' },
{ name: 'wallpaper-right', templateName: 'WALLPAPER', path: 'wallpaper-right' },
{ name: 'inline-content-left-sustainable-packaging', templateName: 'NATIVE', path: 'lrnative_sustainable-packaging' },
{ name: 'inline-content-right-sustainable-packaging', templateName: 'NATIVE', path: 'rrnative_sustainable-packaging' },
{ name: 'leaderboard-sustainable-packaging', templateName: 'LEADERBOARD', path: 'leaderboard_sustainable-packaging' },
{ name: 'rotation-sustainable-packaging', templateName: 'INLINE-CONTENT', path: 'imu_rotation_sustainable-packaging' },
{ name: 'inline-content-left-secondary-packaging', templateName: 'NATIVE', path: 'lrnative_secondary-packaging' },
{ name: 'inline-content-right-secondary-packaging', templateName: 'NATIVE', path: 'rrnative_secondary-packaging' },
{ name: 'leaderboard-secondary-packaging', templateName: 'LEADERBOARD', path: 'leaderboard_secondary-packaging' },
{ name: 'rotation-secondary-packaging', templateName: 'INLINE-CONTENT', path: 'imu_rotation_secondary-packaging' },
{ name: 'inline-content-left-coding-printing-labeling', templateName: 'NATIVE', path: 'lrnative_coding-printing-labeling' },
{ name: 'inline-content-right-coding-printing-labeling', templateName: 'NATIVE', path: 'rrnative_coding-printing-labeling' },
{ name: 'leaderboard-coding-printing-labeling', templateName: 'LEADERBOARD', path: 'leaderboard_coding-printing-labeling' },
{ name: 'rotation-coding-printing-labeling', templateName: 'INLINE-CONTENT', path: 'imu_rotation_coding-printing-labeling' },
{ name: 'inline-content-left-flexibles', templateName: 'NATIVE', path: 'lrnative_flexibles' },
{ name: 'inline-content-right-flexibles', templateName: 'NATIVE', path: 'rrnative_flexibles' },
{ name: 'leaderboard-flexibles', templateName: 'LEADERBOARD', path: 'leaderboard_flexibles' },
{ name: 'rotation-flexibles', templateName: 'INLINE-CONTENT', path: 'imu_rotation_flexibles' },
{ name: 'inline-content-left-rigid', templateName: 'NATIVE', path: 'lrnative_rigid' },
{ name: 'inline-content-right-rigid', templateName: 'NATIVE', path: 'rrnative_rigid' },
{ name: 'leaderboard-rigid', templateName: 'LEADERBOARD', path: 'leaderboard_rigid' },
{ name: 'rotation-rigid', templateName: 'INLINE-CONTENT', path: 'imu_rotation_rigid' },
{ name: 'inline-content-left-trends', templateName: 'NATIVE', path: 'lrnative_trends' },
{ name: 'inline-content-right-trends', templateName: 'NATIVE', path: 'rrnative_trends' },
{ name: 'leaderboard-trends', templateName: 'LEADERBOARD', path: 'leaderboard_trends' },
{ name: 'rotation-trends', templateName: 'INLINE-CONTENT', path: 'imu_rotation_trends' },
]);

module.exports = config;
3 changes: 2 additions & 1 deletion sites/packworld.com/server/routes/website-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const webinars = require('@pmmi-media-group/package-global/templates/website-sec
const events = require('@pmmi-media-group/package-global/templates/website-section/events');
const collections = require('@pmmi-media-group/package-global/templates/website-section/collections');
const withTopStoriesBlock = require('@pmmi-media-group/package-global/templates/website-section/with-top-stories-block');
const superCategory = require('@pmmi-media-group/package-global/templates/website-section/super-category');

const { newsletterState } = require('@pmmi-media-group/package-global/middleware/newsletter-state');

Expand Down Expand Up @@ -136,7 +137,7 @@ module.exports = (app) => {
}));

app.get('/:alias([a-z0-9-/]+)', newsletterState(), withWebsiteSection({
template: section,
template: superCategory,
queryFragment,
}));
};

0 comments on commit 272d784

Please sign in to comment.