From 51dbd4cda3e9c3c05c1672761ae954f7dbafff22 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Fri, 20 Sep 2019 19:54:59 +0300 Subject: [PATCH] Fix archive page --- src/docs/pages/archive.js | 40 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/docs/pages/archive.js b/src/docs/pages/archive.js index b48aa13e8..12814f0bb 100644 --- a/src/docs/pages/archive.js +++ b/src/docs/pages/archive.js @@ -11,7 +11,7 @@ import SnippetCard from '../components/SnippetCard' // Individual snippet category/tag page // =================================================== const ArchivePage = props => { - const posts = props.data.allMarkdownRemark.edges; + const snippets = props.data.allSnippet.edges; React.useEffect(() => { props.dispatch(pushNewPage('Archived', props.path)); @@ -24,17 +24,17 @@ const ArchivePage = props => {

Archived snippets

These snippets, while useful and interesting, didn't quite make it into the repository due to either having very specific use-cases or being outdated. However we felt like they might still be useful to some readers, so here they are.

Click on a snippet card to view the snippet.

- {posts && - posts.map(({ node }) => ( + {snippets && + snippets.map(({ node }) => ( v.trim()), - id: node.fields.slug.slice(1), + title: node.title, + html: node.html.text, + tags: node.tags.all, + id: node.id }} isDarkMode={props.isDarkMode} /> @@ -55,25 +55,19 @@ export default connect( )(ArchivePage); export const archivePageQuery = graphql` - query ArchivePage { - allMarkdownRemark( - limit: 1000 - sort: { fields: [frontmatter___title], order: ASC } - filter: { fileAbsolutePath: { regex: "/snippets_archive/" }, frontmatter: {title: { ne: "" } } } - ) { - totalCount + query archiveListing { + allSnippet(filter: {archived: {eq: true}}) { edges { node { + title + html { + text + } + tags { + all + primary + } id - html - rawMarkdownBody - fields { - slug - } - frontmatter { - title - tags - } } } }