Skip to content

Commit 65cba12

Browse files
add swarm learning to blog tabs
1 parent ea8de4d commit 65cba12

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
lines changed

gatsby-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ module.exports = {
374374
"data-services-cloud-console",
375375
"determined-ai",
376376
"cray",
377+
"swarm-learning"
377378
]}}}, sort: {fields: [frontmatter___date], order: DESC}) {
378379
nodes {
379380
id
@@ -436,6 +437,7 @@ module.exports = {
436437
),
437438
paginatedCollection('determined-ai-posts', 'determined-ai'),
438439
paginatedCollection('cray-posts', 'cray'),
440+
paginatedCollection('swarm-posts', 'swarm-learning'),
439441
paginatedCollection('dscc-posts', 'data-services-cloud-console'),
440442
{
441443
resolve: 'gatsby-plugin-paginated-collection',

gatsby-node.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ exports.createPages = async ({ graphql, actions }) => {
203203
paginatedCollectionQuery('smartsim-posts'),
204204
);
205205

206-
const crayQueryResult = await graphql(paginatedCollectionQuery('cray-posts'));
206+
const crayQueryResult = await graphql(
207+
paginatedCollectionQuery('cray-posts'),
208+
);
209+
210+
const swarmQueryResult = await graphql(
211+
paginatedCollectionQuery('swarm-posts'),
212+
);
207213

208214
const othersQueryResult = await graphql(
209215
paginatedCollectionQuery('others-posts'),
@@ -233,6 +239,7 @@ exports.createPages = async ({ graphql, actions }) => {
233239
setPagination(simplivityQueryResult);
234240
setPagination(smartsimQueryResult);
235241
setPagination(crayQueryResult);
242+
setPagination(swarmQueryResult);
236243
setPagination(othersQueryResult);
237244

238245
return graphql(

src/components/BlogTabs/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ function BlogTabs({ data, columns }) {
112112
label: 'HPE Cray Programming Environment',
113113
count: data?.crayBlogsCount?.totalCount || 0,
114114
},
115+
swarmBlogs: {
116+
label: 'HPE Swarm Learning',
117+
count: data?.swarmBlogsCount?.totalCount || 0,
118+
},
115119
};
116120

117121
const opensource = {
@@ -407,6 +411,7 @@ BlogTabs.propTypes = {
407411
smartSimBlogsCount: PropTypes.objectOf(PropTypes.number),
408412
dsccBlogsCount: PropTypes.objectOf(PropTypes.number),
409413
crayBlogsCount: PropTypes.objectOf(PropTypes.number),
414+
swarmBlogsCount: PropTypes.objectOf(PropTypes.number),
410415
othersBlogsCount: PropTypes.objectOf(PropTypes.number),
411416
}).isRequired,
412417
columns: PropTypes.shape({

src/pages/blog/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,28 @@ export const pageQuery = graphql`
494494
id
495495
}
496496
}
497+
swarmBlogsCount: allMarkdownRemark(
498+
filter: {
499+
fields: { sourceInstanceName: { eq: "blog" } }
500+
frontmatter: { tags: { eq: "swarm-learning" }, disable: { ne: true } }
501+
}
502+
sort: { fields: [frontmatter___date], order: DESC }
503+
) {
504+
totalCount
505+
}
506+
swarmBlogs: paginatedCollectionPage(
507+
collection: { name: { eq: "swarm-posts" } }
508+
index: { eq: 0 }
509+
) {
510+
nodes
511+
hasNextPage
512+
nextPage {
513+
id
514+
}
515+
collection {
516+
id
517+
}
518+
}
497519
simplivityBlogsCount: allMarkdownRemark(
498520
filter: {
499521
fields: { sourceInstanceName: { eq: "blog" } }

src/templates/blog-post.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function BlogPostTemplate({ data }) {
111111
n.node.frontmatter.tags.includes(tag) &&
112112
count < 8 &&
113113
!ids.includes(n.node.id) &&
114-
post.id!==n.node.id &&
114+
post.id !== n.node.id &&
115115
n.node.frontmatter.authorimage &&
116116
n.node.frontmatter.author
117117
) {
@@ -121,7 +121,9 @@ function BlogPostTemplate({ data }) {
121121
}
122122
});
123123
});
124-
const blogCards = ids.map((item, i) => <BlogCard key={item} node={node[i]} />);
124+
const blogCards = ids.map((item, i) => (
125+
<BlogCard key={item} node={node[i]} />
126+
));
125127

126128
return (
127129
<Layout title={siteTitle}>

src/templates/tags.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ export const pageQuery = graphql`
113113
limit: 2000
114114
sort: { fields: [frontmatter___date], order: DESC }
115115
filter: {
116-
frontmatter: { tags: { regex: $tagRE },disable: {ne: true} }}
116+
frontmatter: { tags: { regex: $tagRE }, disable: { ne: true } }
117+
}
117118
) {
118119
totalCount
119120
edges {

0 commit comments

Comments
 (0)