volto icon indicating copy to clipboard operation
volto copied to clipboard

Linked headlines

Open tiberiuichim opened this issue 3 years ago • 2 comments

tiberiuichim avatar Jul 31 '22 20:07 tiberiuichim

Deploy Preview for volto ready!

Name Link
Latest commit 9d4e6590fa8e55c2022343d644e0833c4b8790a1
Latest deploy log https://app.netlify.com/sites/volto/deploys/64957c7ac8a5ed0008196a41
Deploy Preview https://deploy-preview-3540--volto.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 settings.

netlify[bot] avatar Jul 31 '22 20:07 netlify[bot]

Passing run #5860 ↗︎

0 507 20 0 Flakiness 0

Details:

Linked headlines refactor (#4287)
Project: Volto Commit: 9d4e6590fa
Status: Passed Duration: 14:10 💡
Started: Jun 23, 2023 11:08 AM Ended: Jun 23, 2023 11:22 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

cypress[bot] avatar Jul 31 '22 20:07 cypress[bot]

@sneridagh This works, but the cypress and a11y tests need to be fixed. I'll need assistance on this, also maybe the CSS needs to be redone.

tiberiuichim avatar Oct 14 '22 09:10 tiberiuichim

@tiberiuichim

Hmm. This breaks the Table of contents block as it is generated based on the blocks uids.

Also, @razvanMiu confirmed that the block uids are used somewhere within the Link widget to link to sections within the page.

Thus, I think it's safer for now to go with the block UIDs in order not to introduce it as a breaking change and in a separate PR/PLIP we can talk about changing the heading ids to more friendly names (maybe the same way we do with the Override the TOC entry checkbox).

avoinea avatar Jan 17 '23 11:01 avoinea

"breaking the toc" is not a blocker, we can fix the toc block.

It would represent a major breaking change for Volto, though.

tiberiuichim avatar Jan 17 '23 11:01 tiberiuichim

@tiberiuichim I checked out this branch and I quite like it! I guess we always thought too hard about how an editor could enter the anchor ID in the UI. Though, this solution is both elegant and simple. The only possible downside that I see is that links can break easily when editors change a headline.

tisto avatar Mar 06 '23 22:03 tisto

@tisto This feature is also available as an add-on until it hits Volto Core. See: https://github.com/eea/volto-anchors

avoinea avatar Mar 06 '23 23:03 avoinea

I was also thinking about the adaptability of this feature, whether make it available per content-type, or per block?

nileshgulia1 avatar Mar 07 '23 06:03 nileshgulia1

The only possible downside that I see is that links can break easily when editors change a headline.

Yes, it's a downside. But I would argue that we shouldn't focus too much on this type of scenario, it's counterproductive. Honestly, because this PR is modeled after the github readmes, it happened to me many times that I arive at a document where the link is no longer valid. And it's frustrating, yes, but in reality I could scan the destination document to find the info I was looking for. Or I could look at the URL fragment and understand what the new section would be. Or the document was fully refactored, split into multiple pages, so the link would no longer be valid anyway.

What we're gaining is simplicity for the "happy case".

tiberiuichim avatar Mar 07 '23 07:03 tiberiuichim

@tiberiuichim would it be possible to enable/disable this via a feature toggle? This would give us some flexibility in which Volto version we could ship this feature.

tisto avatar Mar 11 '23 06:03 tisto

@tisto sure!

Even in its current form, it's ultimately configurable, as we're replacing the way the hx elements are rendered, in the config:

image

tiberiuichim avatar Mar 11 '23 06:03 tiberiuichim

@tiberiuichim awesome!

tisto avatar Mar 12 '23 21:03 tisto

🎉

nileshgulia1 avatar Jun 24 '23 10:06 nileshgulia1