fastify/website-metalsmith

Feature: switching docs version should retain the current page (if exists)

Open

#161 创建于 2020年3月20日

在 GitHub 查看
 (7 评论) (1 反应) (1 负责人)HTML (127 fork)github user discovery
help wantedsemver-minor

仓库指标

Star
 (77 star)
PR 合并指标
 (PR 指标待抓取)

描述

🚀 Feature Proposal

As proposed by @Eomm in #160:

When you switch version in a page (like decorators for ex), the user is sent to the TOC, could we maintain the path changing only the version-path-param?

Motivation + Example

The user might be reading a page, for instance Request, and suddenly realises they are reading the doc for the wrong version. They might switch to the desired version but the switch will bring them to the ToC for that version rather than to the Request page for that version. So they have to navigate manually to the Request page, which requires extra effort.

Potential issue: pages might not exist in all versions

When a page does not exist in a given version, what do we do?

  • Option 1: we don't show the version itself in the dropdown
  • Option 2: we show the version but we point it to the Table of Contents for that version

Any preference @Eomm, @mcollina, @jsumners ?

Possible implementation

  • In the process-releases script, build a data file with an array of all the docs paths available.
  • In the template, where we render the dropdown boxes, we can easily check if a given page exists or not by accessing the data from the file above.

贡献者指南