solidjs / solid-docs

SolidJS Docs.
https://docs.solidjs.com/
224 stars 264 forks source link

Fix reference collection #920

Closed Bytenote closed 4 days ago

Bytenote commented 2 weeks ago

Description(required)

Two changes were made in this PR, both in regards to the reference collection.

The first change fixes a bug in the DocsLayout, which can lead to a wrong title and pagination being displayed, as you can see here: https://docs.solidjs.com/reference/reactive-utilities/on

Instead of showing the title and pagination for the reactive utility "on", the docs page shows that for the JSX attribute "on:*".
The entryIndex is only comparing the slug value of the given reference entries, which is not unique ("on" for both entries). The fix matches the entire location.pathname to the element.path to find the correct collection item. Both the learn and reference collections are impacted by this change.

The second change matches the child order of the reference collection to the alphabetically ordered reference navbar, by sorting the entries by title.

It was possible that the pagination would not link to the next and/or previous reference docs page in the navbar, see here: https://docs.solidjs.com/reference/jsx-attributes/once

The pagination should link to the pages "Switch Match" and "attr:", since these are the surrounding elements in the navbar, but instead links to "on:" and "prop:*". This change does not effect the learn collection. Only the reference navbar is getting sorted alphabetically (see src/ui/layout/main-navigation.tsx).

stackblitz[bot] commented 2 weeks ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

netlify[bot] commented 2 weeks ago

Deploy Preview for solid-docs ready!

Name Link
Latest commit e420d832a36d637da863fe7241b20776384632b4
Latest deploy log https://app.netlify.com/sites/solid-docs/deploys/671a6c0f594bfa0008e1affb
Deploy Preview https://deploy-preview-920--solid-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.