Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement navigation for deep site traversal #10

Open
MattReimer opened this issue Jan 2, 2024 · 2 comments
Open

Implement navigation for deep site traversal #10

MattReimer opened this issue Jan 2, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request Gatsby Anything related specifically to Gatsby

Comments

@MattReimer
Copy link
Member

MattReimer commented Jan 2, 2024

The current design doesn't seem to have any mechanism for easily traversing the site. On the old site we had the (somewhat clunky but usable) automatic table of contents tree that would open to whatver level you were on:

Screenshot 2024-01-02 at 12 31 27 PM

Having this in the Gatsby theme is somewhat important for our satellite docs sites as they can get quite technical and deep in their navigation.

I also think the mechanism should be automatic as maintaining menu links for rapidly changing subpages seems really error-prone.

NOTE: We probably need to do ALL options here but I think Option 3 solves the direct problem outlined here.

Option 1: Menus

The menu system doesn't currently handle sub sub links.

module.exports = {
   // ... 
    menuLinks: [
      {
        title: 'About us',
        url: '/contentPages',
        // This level works fine
        items: [
          {
            title: 'What is a riverscape',
            url: '/contentPages/contentSubFolder',
            // This was never considered in the design
            items: [
              {
                title: 'Level 2 A',
                url: '/contentPages/contentSubFolder',
              },
              {
                title: 'Level 2 B',
                url: '/contentPages/contentSubFolder',
              },
            ],
          },
          {
            title: 'FAIR principles',
            url: '/contentPages/contentSubFolder',
          },
        ],
      },

Option 2: Automatic Story cards for child pages

You'll notice on the main website the our-work page and all its children have story cards below the page content.

Screenshot 2024-01-02 at 12 24 34 PM

But this only works on the main site and ONLY for children of the Our Work page. Notice the hardcoding in PageTemplate.tsx

export const pageQuery = graphql`
  query BlogPostBySlug($id: String!) {
    site {
      siteMetadata {
        title
      }
    }
    mdx(id: { eq: $id }) {
      id
      excerpt(pruneLength: 160)
      body
      frontmatter {
        title
        date(formatString: "MMMM DD, YYYY")
        description
        banner
        isHome
      }
      tableOfContents(maxDepth: 3)
    }
    # NOTICE THE HARD CODING TO REGEX MATCH THE SLUG
    allMdx(filter: { fields: { slug: { regex: "/our-work//" } } }) {
      nodes {
        id
        fields {
          slug
        }
        frontmatter {
          description
          title
          blurb
          isHome
          imageAlt
          image {
            childImageSharp {
              gatsbyImageData(width: 800)
            }
          }
        }
      }
    }
  }
`

Option 3: Automatic Site contents widget

We should implement a site contents widget like on the old jekyll sites that prints a site tree.

We should be able to have a basic choice about what sites have this and a way to turn it off on the root Riverscapes site (because it is highly curated and doesn't need it)

Option 4: Search

At present we have not implemented Search on our sites. I will open a separate card for that.

@MattReimer MattReimer added the enhancement New feature or request label Jan 2, 2024
@MattReimer MattReimer changed the title Deep Site Traversal impossible Implement Navifation for Deep Site Traversal Jan 2, 2024
@MattReimer MattReimer changed the title Implement Navifation for Deep Site Traversal Implement navigation for deep site traversal Jan 2, 2024
@joewheaton
Copy link

I think I like options 3 and 4... I'm guessing widget is optional to include on some pages? Would search 🔍 be up top?

@MattReimer
Copy link
Member Author

I think I like options 3 and 4... I'm guessing widget is optional to include on some pages? Would search 🔍 be up top?

Up to us really. We've got to find some way to make this function work both on the satellite sites AND the root site.

@MattReimer MattReimer added the Gatsby Anything related specifically to Gatsby label Jan 29, 2024
@MattReimer MattReimer self-assigned this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Gatsby Anything related specifically to Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants