---
layout: compress
---

<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">

{% include header.html %}

<body data-theme="{{ site.mode }}" class="notransition">

  <script>
    const body = document.body;
    const data = body.getAttribute("data-theme");

    const initTheme = (state) => {
      if (state === "dark") {
        body.setAttribute("data-theme", "dark");
      } else if (state === "light") {
        body.removeAttribute("data-theme");
      } else {
        localStorage.setItem("theme", data);
      }
    };
 
    initTheme(localStorage.getItem("theme"));
    
    setTimeout(() => body.classList.remove("notransition"), 75);
  </script>

  {% include navbar.html %}
  <div class="wrapper post">
    <main class="page-content" aria-label="Content">
      <article itemscope itemtype="https://schema.org/BlogPosting">

        <header class="header">
          {% if page.tags and page.tags != empty %}
          <div class="tags">
            {% assign tags = page.tags %}
            <span itemprop="keywords">
              {% for tag in tags %}
              <a class="tag"
                href="/tags/#{{tag | downcase | slugify}}">{{tag | upcase }}</a>{% unless forloop.last %},{% endunless %}
              {% endfor %}
            </span>
          </div>
          {% endif %}
          <h1 class="header-title" itemprop="headline">{{ page.title | escape }}</h1>
          {% if page.date %}
          <div class="post-meta">
            <time class="header-date" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
              {% assign date_format = site.minima.date_format | default: "%d %b، %Y" %}{{ page.date | date: date_format }}
            </time>
            <span itemprop="author" itemscope itemtype="https://schema.org/Person">
              <span itemprop="name">{{ site.author.name }}</span>
            </span>
            {% if page.modified %}
            <div>
                <time class="date-modify" datetime="{{ page.modified | date_to_xmlschema }}" itemprop="dateModified">
                  {% assign date_format = site.minima.date_format | default: "%d %b، %Y" %}{{ page.modified | date: date_format }}
                </time>
                به روز شد.
            </div>
            {% endif %}
            <span hidden itemprop="publisher" itemtype="Person">{{ site.author.name }}</span>
            <span hidden itemprop="image">{{ page.image }}</span>
            <span hidden itemprop="mainEntityOfPage">{{ page.excerpt }}</span>
          </div>
          {% endif %}
        </header>

        {% toc %}

        <div class="page-content" itemprop="articleBody">
          {% include anchor_headings.html html=content anchorClass="anchor-head" beforeHeading=true h_min=1 h_max=4 %}
          {% if page.tweet %}
          <p>Comments this article on 
            <a href="https://twitter.com/{{site.twitter}}/status/{{page.tweet}}">Twitter</a>.
          </p>
          {% endif %}
        </div>
      </article>
    
      {% if page.comments %}
        {% include comments.html %}
      {% endif %}

      {% if page.mastodon %}
        {% include mastodon.html %}
      {% endif %}

    </main>

    {% if page.next or page.previous %}
      {% include navigation.html %}
    {% endif %}

    {% include footer.html %}
  </div>
  <!-- add copy button to code blocks -->
  <script>
    document
      .querySelectorAll('figure.highlight')
      .forEach(function (pre) {
        var button = document.createElement('button');
        var copyText = `<i class="fa fa-copy"></i>`;
        button.type = 'button';
        button.ariaLabel = 'Copy code to clipboard';
        button.innerHTML = copyText;
        button.addEventListener('click', function () {
          var code = pre.querySelector('code').innerText.trim();
          navigator.clipboard.writeText(code);
          button.innerHTML = `<i class="fa fa-check"></i>`;
          setTimeout(function () {
            button.blur();
            button.innerHTML = copyText;
          }, 2e3);
        });
        pre.appendChild(button);
      });
  </script>
</body>

</html>