Closed utterances-bot closed 2 years ago
How DO you change the theme dynamically? it is damn interesting! Hats off to you sir! :octocat:
My blog uses CODEDOC, which has this DarkLight
component. In my markdown, I add both the dark- and light-themed utterance scripts (which are extracted into this custom component). It is dynamic in that it changes without a full reload of the page (complements to CODEDOC and the DarkLight
component), but it also does two queries to the GitHub API to obtain the comments (one for the dark theme and one for the light theme). Of course it would be better if there were only one such query, but I don't care to optimize this at the moment.
Whoa. Cool!
I might even requery each time the theme is changed.
So, do I need any plugin for this to work?
I don't think so. I think CODEDOC is enough.
Not that, for Utterances!
Oh. I have no idea how Utterances works. Sorry.
Oh. I have no idea how Utterances works. Sorry.
Ah, it's simple. Every comment is made with a bot, which converts that comment to a new issue in your specific repository. And then, it uses a GET request(I think, because it uses JS for the script.) to get the latest comment in THAT SPECIFIC ISSUE into the JS that got posted there.
Oh. Sorry again. I meant that I don't understand how the frontend works. I understand how the backend works. I thought you were trying to figure out some frontend solution.
Lock Hunter
https://tysonwilliams.coding.blog/2021-06-21_lock_hunter