utterance / utterances

:crystal_ball: A lightweight comments widget built on GitHub issues
https://utteranc.es
MIT License
8.68k stars 566 forks source link

New pathnameVersion issue-term type #568

Open nvuillam opened 2 years ago

nvuillam commented 2 years ago

Fixes #567

New issue-term pathnameVersion, to remove first segment of pathname in case the documentation is versioned

Some documentations are versioned (mkdocs-material with mike, for example )

To not have different comments depending on versions, we need to be able to use my/doc/page as issue-term instead of v5.0.1/my/doc/page

Example code to embed:

<script src="https://utteranc.es/client.js"
        repo="megalinter/megalinter"
        issue-term="pathnameVersion"
        label="comments"
        theme="github-light"
        crossorigin="anonymous"
        async>
</script>
nvuillam commented 2 years ago

So you mean that I could build the issue title directly in my website code, then pass it to utterances ?

I could do that, but with the huge number of versioned documentations built with mkdocs, i thought it will be nice to do that within utterances, so it will save time to all the doc maintainers who will use you great tool :)

zsdycs commented 2 years ago

So you mean that I could build the issue title directly in my website code, then pass it to utterances ?

I could do that, but with the huge number of versioned documentations built with mkdocs, i thought it will be nice to do that within utterances, so it will save time to all the doc maintainers who will use you great tool :)

😄Whether to merge or not is determined by @jdanyow , but I think the probability of merger is small. "utterances" hasn't added new features for a long time.

nvuillam commented 2 years ago

@zsdycs i hope ot will be accepted, this will please for sure to all mkdocs / mike users :)

https://github.com/mkdocs/mkdocs

https://github.com/jimporter/mike

laymonage commented 2 years ago

An alternative I would suggest is adding a regex option to capture whatever part you want from the string to search for the issue. That could work with other mappings as well, such as title, og:title, etc.

Shameless plug: I think that's something I would like to add to my project giscus :eyes:

nvuillam commented 2 years ago

@jdanyow any chance to see this PR merged someday ? :)