Skip to content

Commit

Permalink
feat: add to changelog. Remove commmented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
timwessman committed Nov 21, 2024
1 parent 2408e7c commit ebd9d55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Changes that are not related to specific components

#### Added

- Documentation of older versions (3.11 & 2.17) of HDS is also available on the documentation site.
- [StatusLabel] Documentation about SCSS usage.
- [Breadcrumbs] Documentation about SCSS usage.
- [Checkbox] Documentation about SCSS usage.
Expand Down
46 changes: 17 additions & 29 deletions site/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,43 +91,31 @@ exports.createPages = async ({ actions, graphql }) => {
throw new Error('Failed to fetch MDX data');
}

const brokenPages = [
/*
'/release-3.11.0/components/phone-input',
'/release-3.11.0/components/dropdown',
*/
];

// Create pages dynamically
result.data.allMdx.edges.forEach(({ node }) => {
const gitRemote = node.parent?.gitRemote?.ref;
const pathWithVersion = path.join('/', gitRemote || '', node.frontmatter.slug);

if (!brokenPages.includes(pathWithVersion)) {
try {
const pageTemplate = require.resolve('./src/components/ContentLayoutWrapper.js');
const contentPath = './src/docs/' + node.parent.relativePath.replace('site/src/docs/', '');
try {
const pageTemplate = require.resolve('./src/components/ContentLayoutWrapper.js');
const contentPath = './src/docs/' + node.parent.relativePath.replace('site/src/docs/', '');

console.log('createPage() ' + gitRemote + ' ' + contentPath);
console.log('createPage() ' + gitRemote + ' ' + contentPath);

const pageContent = gitRemote
? require.resolve(`./.cache/gatsby-source-git/docs-${gitRemote}/${node.parent.relativePath}`)
: require.resolve(contentPath);
const pageContent = gitRemote
? require.resolve(`./.cache/gatsby-source-git/docs-${gitRemote}/${node.parent.relativePath}`)
: require.resolve(contentPath);

createPage({
component: `${pageTemplate}?__contentFilePath=${pageContent}`,
path: pathWithVersion,
context: {
id: node.id,
frontmatter: { ...node.frontmatter, slug: pathWithVersion },
},
});
} catch (e) {
console.error(e);
}
}
else {
console.log('Skip', pathWithVersion);
createPage({
component: `${pageTemplate}?__contentFilePath=${pageContent}`,
path: pathWithVersion,
context: {
id: node.id,
frontmatter: { ...node.frontmatter, slug: pathWithVersion },
},
});
} catch (e) {
console.error(e);
}
});
};

0 comments on commit ebd9d55

Please sign in to comment.