Sphinx#

Tombo NotesはSphinxを使用してHTMLを生成しています。

Install#

apt-getでインストールするとversionが古いのでpipでインストールするのがオススメです。

$ pip3 install --user Sphinx # user install

Google タグマネージャーの導入#

テンプレート を使うと、Googleタグマネージャーのコードを注入することができます。

Googleタグマネージャーのコードの注入すべき場所は

  • javascriptは<head>タグ内上部

  • noscriptは<body>タグ直後

が好ましいとされています。

組み込みテンプレート を踏襲しているテーマであれば、
前者に関してはextraheadブロック、後者はrelbar1ブロック内に注入すれば良さそうです。

以下がその例です。

{% extends "!layout.html" %}

{% block extrahead %}
  <!-- Google Tag Manager -->
  ...
  <!-- End Google Tag Manager -->
  {{ super() }}
{% endblock %}

{% block relbar1 %}
  <!-- Google Tag Manager (noscript) -->
  ...
  <!-- End Google Tag Manager (noscript) -->
  {{ super()}}
{% endblock %}

プラグイン#

sphinxcontrib-newsfeed#

$ pip3 install --user sphinxcontrib-newsfeed
$ pip3 install --user git+https://github.com/prometheusresearch/sphinxcontrib-newsfeed.git

Pypiはdisqusがhttpsドメインに対応していない ので、disqusを使うならgithubからinstallするとよいです。

索引について#

日本語の索引は扱えない。

https://sphinx-users.jp/reverse-dict/writing/indexing.html

残念ながら日本語の項目はきちんと扱えません。

Real World HTTP はSphinxで作られているが、索引は手動とのこと https://twitter.com/shibu_jp/status/1296626228468752385

索引は手動です。Sphinxからindesign-builderでinDesignのXMLにして、それを取り込んでinDesign上で仕上げされているはずです。