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

[Anchor Link Request] Main Navigation override with custom links #110

Closed
Corey-Albright-OnTheClock opened this issue Apr 8, 2019 · 4 comments

Comments

@Corey-Albright-OnTheClock

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I am trying to do inline links that appear on left navigation bar, so that when I click a link. It then scrolls to the heading level of 2.

Describe the solution you'd like
A clear and concise description of what you want to happen.
Looking for main navigation anchor links
Anchor Links

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

I have thought about editing the main nav html

Additional context
Add any other context or screenshots about the feature request here.

@Corey-Albright-OnTheClock Corey-Albright-OnTheClock changed the title Main Navigation override with custom links [Anchor Link Request] Main Navigation override with custom links Apr 8, 2019
@Corey-Albright-OnTheClock
Copy link
Author

Corey-Albright-OnTheClock commented Apr 8, 2019

I am considering the following alternatives:

  • refresh page after 1 second and goes to permalink (long handed and tedious)
    -- parent page to include page with refresh to 1 second on running page that would link to the insertion point for the div
  • Editing file:
    -- nav.html

@Corey-Albright-OnTheClock
Copy link
Author

A perfect example:
Navigation Structure
would be to put the TOC within the section: all of the TOC on left side within the section called Navigation Structure

Like:

Navigation Structure:
--> Main navigation
Ordering pages
Excluding pages
Pages with children
Child pages
Auto-generating Table of Contents
Children with children
Auxiliary Navigation
In-page navigation with Table of Contents

^ On left side / main nav under Navigation Structure

@pmarsceill
Copy link
Collaborator

This is not something we will support out-of-the-box at this time.

@katrpilar
Copy link

katrpilar commented Sep 5, 2019

@Corey-Albright-OnTheClock I absolutely had to have the ability to navigate between markdown anchor links from child navigation items in the main menu as well. After a lot of trial and error, I figured out a way to do this without reloading the current parent view. I have twice as many anchor sections under Core Concepts than listed here. So, naturally, I wanted to improve navigation to each section without separating each section into its own markdown file OR having to reload the page to link to these section in the child menu navigation. (just as you have described)

My menu structure looks like this:

  • About
    • Core Concepts
      • Data Flow
      • Object Types
      • Authentication
      • Pagination
      • Error Handling
      • Data Flow
      • Configurations
      • Filters

My Solution

Given the above structure, my solution was to create a folder sectionAnchors in the same file location of the parent navigation page coreConcepts.md. Then, I created the empty (except config) markdown files with for each of the sections inside the sectionAnchors folder. The key here is to NOT provide a layout in the placeholder empty config child sectionAnchors markdown files as shown below in the dataFlow.md example.

coreConcepts.md (Parent)

---
layout: page
title: Core Concepts
permalink: /about/concepts
parent: About
nav_order: 2
has_children: true
---

## Data Flow
A ton of text and explanations of how to understand the data flow.

dataFlow.md (coreConcepts's child anchor link)

---
title: Data Flow
permalink: /about/concepts#data-flow
parent: Core Concepts
nav_order: 1
---

Note

Local and published anchor permalinks seem to behave slightly differently for some reason and require an extra / before the # when running things locally for this to work? (see below).

Published: Github Pages

/about/concepts#data-flow

Local: bundle exec jekyll serve.

/about/concepts/#data-flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants