LoginSignup
2
0

More than 1 year has passed since last update.

Franklin.jlを使って自分のウェブサイトを作る話

Last updated at Posted at 2022-04-30

Franklin.jlを使って自分のウェブサイトを作りたい

Franklin.jlを使って簡単にWebサイトを作れるみたいです。以下のサイトを参考に作成したところ、途中でちょっと詰まった箇所があったので備忘録としてまとめておきます。

基本的には記事に書いてあることを実行して、Webページを作ります。しかし、途中の実行結果がうまく表示されない事態が起こりました(以下の図を参照)

franklin (1).jpg

あれ、何かおかしい。。

原因は、config.mdのファイルがデフォルトのままになっていたことでした。解決するには、config.mdのファイルを自分のウェブサイトのURLに設定する必要がありました。
例えば私の場合、

@def website_title = "Rihito Sakurai's website" @def website_descr = "website" @def website_url = "https://sakurairihito.github.io"

@def author = "Rihito Sakurai"

@def mintoclevel = 2

@def ignore = ["node_modules/", "franklin", "franklin.pub"]

\newcommand{\R}{\mathbb R} \newcommand{\scal}[1]{\langle #1 \rangle}

にする必要があります。

また、githubアクションでpushをトリガーに自動でWebページが更新されるようにします。
設定でsourceをgh-pagesに変更します。

Deploy.ymlは以下のように設定しました。(ほぼデフォルトのままです)

name: Build and Deploy
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        persist-credentials: false
    # NOTE: Python is necessary for the pre-rendering (minification) step
    - name: Install python
      uses: actions/setup-python@v2
      with:
        python-version: '3.8'
    # NOTE: Here you can install dependencies such as matplotlib if you use
    # packages such as PyPlot.
    # - run: pip install matplotlib
    - name: Install Julia
      uses: julia-actions/setup-julia@v1
      with:
        version: 1.6

    - name: Install dependencies listed in Project.toml and build package
      uses: julia-actions/julia-buildpkg@master
    # NOTE
    #   The steps below ensure that NodeJS and Franklin are loaded then it
    #   installs highlight.js which is needed for the prerendering step
    #   (code highlighting + katex prerendering).
    #   Then the environment is activated and instantiated to install all
    #   Julia packages which may be required to successfully build your site.
    #   The last line should be `optimize()` though you may want to give it
    #   specific arguments, see the documentation or ?optimize in the REPL.
    - run: julia --project -e '
            using NodeJS, Franklin;
            run(`$(npm_cmd()) install highlight.js`);
            optimize(minify=true, prerender=true, clear=true)'
            
    - name: Build and Deploy
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        BRANCH: gh-pages
        FOLDER: __site

あとは、自分なりのHPを作ればよさそうです。

参考記事

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0