newsmode
search
Меню
arrow_back Назад

Migrating Site Comments to Utterances

auto_awesomeКраткое саммари

Юджин Ян рассказывает, как перенёс комментарии своего сайта на Utterances — систему, использующую issues на GitHub. До этого комментарии жили в Disqus, затем в Commento. Процесс включал создание отдельного репозитория для комментариев, подключение Utterances через скрипт в шаблоне сайта, выгрузку комментариев из Commento в JSON и их загрузку через GitHub API для импорта issues. Главный минус нового решения — читателям теперь нужно входить через GitHub, чтобы оставить комментарий. Все комментарии теперь доступны как issues в репозитории eugeneyan-comments.

Migrating Site Comments to Utterances

Перенос комментариев сайта на Utterances

[ til python ] · 1 min read

[ til python ] · чтение на 1 мин

Today I learnt how to migrate comments on this site to Utterances. The comments functionality on this site has migrated from Discus to Commento and most recently, utterances. You can see the history in the comments here.

Сегодня я научился переносить комментарии этого сайта на Utterances. Система комментариев на этом сайте мигрировала с Discus на Commento, а совсем недавно — на utterances. Историю можно посмотреть в комментариях здесь.

Here are the steps I took:

Вот шаги, которые я предпринял:

  • Create a repo just for comments.
  • Set up utteranc.es with the repo.
  • Add the html below to my layout template.
  • Создайте отдельный репозиторий для комментариев. Настройте utteranc.es с этим репозиторием. Добавьте приведённый ниже html в шаблон вёрстки.

    <script src="https://utteranc.es/client.js" repo="eugeneyan/eugeneyan-comments" issue-term="url" theme="github-light" crossorigin="anonymous" async> </script>

  • Download site comments from Commento. The download is in json format.
  • Figure out the GitHub API for importing issues; expected payload below.
  • Скачайте комментарии сайта из Commento. Выгрузка идёт в формате json. Разберитесь с GitHub API для импорта issues; ожидаемая полезная нагрузка ниже.

    { "issue": { "title": "Imported from some other system", "body": "..." }, "comments": [ { "body": "comment", "create_at": "timestamp" } ] }

    { "issue": { "title": "Imported from some other system", "body": "..." }, "comments": [ { "body": "comment", "create_at": "timestamp" } ] }

  • Read the json comments, clean them up, and upload via the GitHub API (code).
  • Считайте комментарии из json, очистите их и загрузите через GitHub API (код).

    Now all comments are GitHub issues. Here’s an example of how it looks like in a post. One downside is that readers will need to login via GitHub to be able to comment; hope this isn’t too big of a barrier.

    Теперь все комментарии — это issues на GitHub. Вот пример того, как это выглядит в посте. Один из недостатков в том, что читателям придётся залогиниться через GitHub, чтобы оставить комментарий; надеюсь, это не станет слишком большим барьером.

    If you found this useful, please cite this write-up as:

    Если этот материал оказался полезным, пожалуйста, цитируйте его так:

    Yan, Ziyou. (Sep 2020). Migrating Site Comments to Utterances. eugeneyan.com. https://eugeneyan.com/writing/migrating-to-utterances/.

    Yan, Ziyou. (Sep 2020). Migrating Site Comments to Utterances. eugeneyan.com. https://eugeneyan.com/writing/migrating-to-utterances/.

    or

    или

    @article{yan2020utterance, title = {Migrating Site Comments to Utterances}, author = {Yan, Ziyou}, journal = {eugeneyan.com}, year = {2020}, month = {Sep}, url = {https://eugeneyan.com/writing/migrating-to-utterances/} }

    @article{yan2020utterance, title = {Migrating Site Comments to Utterances}, author = {Yan, Ziyou}, journal = {eugeneyan.com}, year = {2020}, month = {Sep}, url = {https://eugeneyan.com/writing/migrating-to-utterances/} }



    Join 11,800+ readers getting updates on machine learning, RecSys, LLMs, and engineering.

    Присоединяйтесь к 11 800+ читателям, получающим обновления о машинном обучении, RecSys, LLM и инженерии.