kitian616 / jekyll-TeXt-theme

💎 🐳 A super customizable Jekyll theme for personal site, team site, blog, project, documentation, etc.
https://kitian616.github.io/jekyll-TeXt-theme/
MIT License
3.16k stars 2.56k forks source link

Feature request: custom proxy config for Gitalk to solve 403 error #348

Open biociao opened 3 years ago

biociao commented 3 years ago

According to https://github.com/gitalk/gitalk/issues/433, new proxy is needed to solve CORS issue. Current theme version seems not available to config it.

Similar issue in another theme: https://github.com/auroral-ui/hexo-theme-aurora/issues/16

biociao commented 3 years ago

Well, I've found a solution for myself:

  1. Add the following line next to /_config.yml#L131:
    proxy: 'https://<your customized proxy url>'
  2. Add the following line next to /_includes/comments-providers/gitalk.html#L23:
    {%- assign _proxy = _proxy | slice: 2, _last -%}
  3. And this line next to /_includes/comments-providers/gitalk.html#L33:
    proxy: [{{ _proxy }}],
  4. Use the latest version of gitalk at L48 and L59 in /_data/variables.yml
    gitalk:
    js: 'https://unpkg.com/gitalk@latest/dist/gitalk.min.js'
    css: 'https://unpkg.com/gitalk@latest/dist/gitalk.css'

Not perfect but it works now.

Babylonehy commented 3 years ago

Well, I've found a solution for myself:

  1. Add the following line next to /_config.yml#L131:
proxy: 'https://<your customized proxy url>'
  1. Add the following line next to /_includes/comments-providers/gitalk.html#L23:
{%- assign _proxy = _proxy | slice: 2, _last -%}
  1. And this line next to /_includes/comments-providers/gitalk.html#L33:
proxy: [{{ _proxy }}],
  1. Use the latest version of gitalk at L48 and L59 in /_data/variables.yml
gitalk:
  js: 'https://unpkg.com/gitalk@latest/dist/gitalk.min.js'
  css: 'https://unpkg.com/gitalk@latest/dist/gitalk.css'

Not perfect but it works now.

right now, just update the gitalk to the latest version, it sloved.