8000 New feature: A next/previous button for the docs section · Issue #208 · google/docsy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New feature: A next/previous button for the docs section #208
Open
@frodriguezsmartclip

Description

@frodriguezsmartclip

Hi there,

I came from this would be nice a new feature for docsy theme: A next/previous button for the docs section. 🙏

The idea came from this customized docsy theme example website, specifically I saw the apache's airflow webpage documentation section, and I liked it the idea:

Anotación 2020-02-19 091234__192020

The code could be similar to their theme like this? (link)

I made this on my custom theme code for "pager.html" (inside layouts/partials/pager.html): 😃

<ul class="list-unstyled d-flex justify-content-between align-items-center mb-0 pt-5">
  <li>
    <a {{if .Next}}href="{{.Next.Permalink}}"{{end}} class="btn {{if .Next}} btn-outline-primary{{end}} {{if not .Next}} btn-dark disabled{{end}}"><span class="mr-1">←</span> {{ T "ui_pager_prev" }}</a>        
  </li>
    <a {{if .Prev}}href="{{.Prev.Permalink}}"{{end}} class="btn {{if .Prev}} btn-outline-primary{{end}} {{if not .Prev}} btn-dark disabled{{end}}">{{ T "ui_pager_next" }} <span class="ml-1">→</span></a>
  </li>
</ul>

EDIT:

Added other code that I tried to work, but again, ordered by date:

{{ $pages := where site.RegularPages "Section" .Section }}

<ul class="list-unstyled d-flex justify-content-between align-items-center mb-0 pt-5">
{{ with $pages.ByLength.Prev . }}
  <li>
    <a class="btn btn-outline-primary" title="Previous page in {{ .Section }}" href="{{ .Permalink }}"><span class="mr-1">←</span> Previous {{ .Section }}</a>
  </li>
{{ end }}

{{ with $pages.ByLength.Next . }}
  <li>
    <a class="btn btn-outline-primary" title="Next page in {{ .Section }}" href="{{ .Permalink }}">Next {{ .Section }} <span class="ml-1">→</span></a>
  </li>
{{ end }}
</ul>

BUT, It's ordered by date, not by weight inside each section order left side...

Could this be implemented for the docsy theme in the future? It would be amazing! ☺️

Thanks a lot!! Regards

PS: I can not add a LABEL for this issue "enhancement"... maybe is restricted only for admins

@LisaFC @RichieEscarez

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0