Align local nav and add breadcrumbs for pages
Closes #2511
This PR ensures that the page has the correct breadcrumbs. Additionally, it makes the local navigation behave according to the design shown in the image below.
I'm not so sure where the learning pathway term falls, because the term page is already at Level 3 depth, and due to the design, there are no breadcrumbs, so should we follow the behavior of L3 by displaying the term name in the local navigation when scrolling? cc @fcoveram
| Default | Scroll |
|---|---|
Also, for the L2B part, it will need to have a breadcrumb level value to help with the determination. So I'm going to wait to see if the current method of retrieving that value makes sense.
Screenshots
| Default | Scroll | |
|---|---|---|
| L3 | ||
| L2A | Same | |
| Same | ||
| Same. Note that the link isn't highlighted | ||
| Same. Note that the link isn't highlighted | ||
| Same | ||
| L1B | This site doesn't have L1B | - |
| L1A |
Found another edge case @renintw, freestanding Lessons don't have a Course parent for the breadcrumb. Breadcrumb should probably be Home / Lessons / Lesson Title
Found another edge case @renintw, freestanding Lessons don't have a Course parent for the breadcrumb. Breadcrumb should probably be Home / Lessons / Lesson Title
Weird, I don't see this issue either in this PR or in #2594
Found another edge case @renintw, freestanding Lessons don't have a Course parent for the breadcrumb. Breadcrumb should probably be Home / Lessons / Lesson Title
Weird, I don't see this issue either in this PR or in #2594
Try this one https://learn.wordpress.org/lesson/publishing-with-the-block-editor/
Found another edge case @renintw, freestanding Lessons don't have a Course parent for the breadcrumb. Breadcrumb should probably be Home / Lessons / Lesson Title
Weird, I don't see this issue either in this PR or in #2594
Try this one https://learn.wordpress.org/lesson/publishing-with-the-block-editor/
I think that's the data issue, as other freestanding lessons look fine, though I didn't check all the lessons, there might be some out there. This can be fixed by saving the post again, it's likely that the lesson originally belonged to a course, and that course was deleted but the related data for the lesson is still there.
Open a ticket for it: https://github.com/WordPress/Learn/issues/2644#issue-2394564182
Note: this is the logic where processing the freestanding lessons, for the example raised here, it has a value for lesson_course_id, but the course doesn't exist. That's why I think it originally belonged to a course.