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

Don't add links for directories in guides structure #1

Closed
arthurevans opened this issue Sep 18, 2020 · 0 comments
Closed

Don't add links for directories in guides structure #1

arthurevans opened this issue Sep 18, 2020 · 0 comments

Comments

@arthurevans
Copy link
Contributor

To match our current outline, I'd like to omit link for the directories themselves.

I did this by replacing the index.md in a given directory with a stub that contains only metadata, and rewriting the nav template like this:

      <side-nav>
        {%- set navSections = collections.guide | eleventyNavigation -%}
        {# Uncomment to use prebuilt nav
        {{ navSections | eleventyNavigationToHtml | safe }}
        #}
        <ul>
        {%- for entry in navSections %}
          <li{% if entry.url == page.url %} class="my-active-class"{% endif %}>
            {%- if entry.children | length %}
              <span class="sectionHead">{{ entry.title }}</span>
              {% set navPages = entry.children %}
              <ul>
              {%- for entry in navPages %}
                <li{% if entry.url == page.url %} class="my-active-class"{% endif %}>
                  <a href="{{ entry.url | url }}">{{ entry.title }}</a>
                </li>
              {%- endfor %}
              </ul>  
            {%- else %}
              <a href="{{ entry.url | url }}">{{ entry.title }}</a>
            {%- endif %}
          </li>
        {%- endfor %}
        </ul>
      </side-nav>

Not sure if there's a simpler way to do this.

@nicolejadeyee nicolejadeyee added this to the Website complete milestone Feb 10, 2021
@nicolejadeyee nicolejadeyee removed this from the Website complete milestone Feb 10, 2021
aomarks added a commit that referenced this issue May 11, 2022
Previously, we used 0-indexed and left-padded tutorial URLs. For example, the 2nd step of a tutorial had URL `/tutorials/<name>/#1`.

Now it is 1-indexed, and not padded. For example: `/tutorials/<name>/#2`.

I think 0-indexed is more intuitive, because it means the URLs are aligned with the "Step 2/8" text on the page.

I think left-padding was unnecessary in URLs, plus by removing it, we have a convenient way to detect people still on the 0-indexed scheme, and fix the URLs to be 1-indexed. This way nobody will get jumped ahead if they reload before/after the new scheme is deployed.

Also fixes a bug where we would set the URL to `/tutorials/<name>#2` (no trailing slash), but then after reloading it would turn into `/tutorials/<name>/#2`. Now we always set the final form.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants