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

[Bug] Change to rendering of left nav (TOC) in DocFx 2.76.0 means Download PDF link missing #10329

Open
lanthonyneville opened this issue Oct 28, 2024 · 2 comments
Labels
bug A bug to fix

Comments

@lanthonyneville
Copy link

Describe the bug
If the left navigation panel (TOC) is not rendered, but PDF output is enabled, no Download PDF link is rendered (because Download PDF link was part of panel). This makes it appear like PDF download is not available.

To Reproduce
Steps to reproduce the behavior:

  1. Build any site, with PDF output enabled, with DocFx 2.76.0 or 2.77.0
  2. Navigate to home page of built site
  3. Home page shows no left navigation panel (TOC) and no Download PDF link
  4. Navigate to a page within the site with child pages, and the left navigation panel (TOC) including Download PDF link appears

Expected behavior
When a site is configured to output to PDF, and the default (modern) theme is used, a Download PDF link should be rendered on every page .

Context:

  • OS: Windows
  • Docfx version: 2.76.0 and 2.77.0

Additional context
This was working in DocFx 2.75.3, but in DocFx 2.76.0 a change was made resulting in the left navigation panel (TOC) not being rendered in some cases, including the home page (see #10011 and PR #9737).

This issue does not question the change to the left navigation panel rendering. This issue just highlights that the PDF download link needs to appear on all pages to make it obvious and accessible.

Maybe the PDF download link could be rendered in the footer (i.e. where the Previous and Next page links are) ??

@lanthonyneville lanthonyneville added the bug A bug to fix label Oct 28, 2024
@filzrev
Copy link
Contributor

filzrev commented Oct 29, 2024

If the left navigation panel (TOC) is not rendered, but PDF output is enabled, no Download PDF link is rendered (because Download PDF link was part of panel). This makes it appear like PDF download is not available.

To revert older versions behavior.
Explicitly configure _disableToc: false metadata on target page.

Maybe the PDF download link could be rendered in the footer (i.e. where the Previous and Next page links are) ??

If output pdf file is fixed path.
It can customize footer area by modifying _appFooter metadata.

Example YAML header

_appFooter: |-
  <div class="d-flex">
    <div>
      <span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
    </div>
    <div class="ms-auto">
      <div class="toc">
        <a class="pdf-link" href="https://dotnet.github.io/docfx/docs/toc.pdf">Download PDF</a>
      </div>
    <div>
  </div>

@lanthonyneville
Copy link
Author

Thanks - setting _disableToc: false does restore the left nav TOC and the Download PDF link. This is a good workaround for now.

I think the hiding of left nav TOC (introduced in DocFx 2.76.0) is a good feature however. The Download PDF link just needs to be rendered on every page somewhere - not just if the TOC is visible. This is why I asked if it could be moved to be rendered in the footer. Can you do this in a future DocFx version?

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

No branches or pull requests

2 participants