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

Get Blog Post TOC rendering with numbers #391

Merged
merged 6 commits into from
Jul 16, 2024

Conversation

travjenkins
Copy link
Member

@travjenkins travjenkins commented Jul 10, 2024

Changes

#278

  • Switched to an ol
  • Updated styling a bit

Tests / Screenshots

image

@travjenkins travjenkins requested a review from Brenosalv July 10, 2024 20:24
@@ -138,7 +137,7 @@ export const RenderToc = ({ items }: { items: TocItem[] }) => {
</Typography>
</AccordionSummary>
<AccordionDetails className="accordion-side-padding">
<ul>
<ol role="list">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will mark with numbers but also I feel like a more appropriate tag to use semantically.

Copy link

github-actions bot commented Jul 10, 2024

Visit the preview URL for this PR (updated for commit 5f49f10):

https://estuary-marketing--pr391-travjenkins-bug-add-inma2ym6.web.app

(expires Thu, 15 Aug 2024 14:15:19 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 76f6b095a0752e5d9c6c890267f9fdc3e392161e

Brenosalv
Brenosalv previously approved these changes Jul 11, 2024
Copy link
Collaborator

@Brenosalv Brenosalv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@travjenkins
Copy link
Member Author

The main change for SEO is not that we need numbers but that we should display nested headers as well to at least 1 level of depth.

…accordion by default, replace bullet points with numbers, remove extra margin from accordion summary, and migrate <li> style to classes .tocItem and .isItemSelected
@Brenosalv
Copy link
Collaborator

In my commit, I made the following changes:

  • Set the accordion to be expanded by default.
  • Set the same line height for both main and nested items.
  • Replaced bullet points with numbers.
  • Included nested items to update the selected item on scrolling.
  • Added an underline with a 4px offset to all link items, not just nested ones.
  • Changed the text color of items to black instead of default link blue color.
  • Removed the extra margin from the accordion summary.
  • Migrated
  • styles to classes .tocItem and .isItemSelected.

@travjenkins
Copy link
Member Author

Can you timebox to like an hour and see if you can tweak the auto selection of the TOC items. I feel like the item should not be selected right as the user has the heading in view. More like they are a little bit into the section.

image

@Brenosalv
Copy link
Collaborator

The sections do not have a wrapper, so it's hard to detect if they are a little bit or half into the section or not. That's why it's changing the selected link from TOC when the heading shows up.

Instead of:

<section id="section-1">
<h4>
<p>
<p>
<p>
</section>
<section id="section-2">
<h4>
<p>
<p>
<p>
</section>
...

We have:

<h4 id="section-1">
<p>
<p>
<p>
<h4 id="section-2">
<p>
<p>
<p>
...

@travjenkins
Copy link
Member Author

Okay - that makes sense so we can keep it as is.

@travjenkins travjenkins merged commit 12819d7 into master Jul 16, 2024
1 check passed
@travjenkins travjenkins deleted the travjenkins/bug/add-numbers-to-toc branch July 16, 2024 13:14
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

Successfully merging this pull request may close these issues.

2 participants