{% macro support() %}
<p>
    Creating and <a href="{{ get_url(path="@/status-update/_index.md") }}">maintaining</a> this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance.
</p>
<p>
    The best way to support me is to <a href="https://github.com/sponsors/phil-opp"><em>sponsor me on GitHub</em></a>, since they don't charge any fees. If you prefer other platforms, I also have <a href="https://www.patreon.com/phil_opp"><em>Patreon</em></a> and <a href="https://donorbox.org/phil-opp"><em>Donorbox</em></a> accounts. The latter is the most flexible as it supports multiple currencies and one-time contributions.
</p>
<p>
    Thank you!
</p>
{% endmacro support %}

{% macro giscus(search_term, lang) %}
    {% if lang != "en" %}
        {% set category = "Post Comments (translated)" %}
        {% set category_id = "DIC_kwDOAlvePc4CPg4c" %}
        {% set category_path = "post-comments-translated" %}
    {% else %}
        {% set category = "Post Comments" %}
        {% set category_id = "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTMzMDE4OTg1" %}
        {% set category_path = "post-comments" %}
    {% endif %}

    {% if search_term is number %}
        {% set discussion_url = "https://github.com/phil-opp/blog_os/discussions/" ~ search_term %}
    {% else %}
        {% set search_term_encoded = `"` ~ search_term ~ `"` ~ ` in:title` | urlencode %}
        {% set discussion_url = `https://github.com/phil-opp/blog_os/discussions/categories/` ~ category_path ~ `?discussions_q=` ~ search_term_encoded %}
    {% endif %}

    <p class="comment-note">
        Do you have a problem, want to share feedback, or discuss further ideas? Feel free to leave a comment here! Please stick to English and follow Rust's <a href="https://www.rust-lang.org/policies/code-of-conduct">code of conduct</a>. This comment thread directly maps to a <a href="{{ discussion_url | safe }}"><em>discussion on GitHub</em></a>, so you can also comment there if you prefer.
    </p>

    <div class="giscus"></div>

    <script src="https://giscus.app/client.js"
        data-repo="phil-opp/blog_os"
        data-repo-id="MDEwOlJlcG9zaXRvcnkzOTU3NTEwMQ=="
        data-category="{{ category }}"
        data-category-id="{{ category_id }}"
    {% if search_term is number %}
        data-mapping="number"
    {% else %}
        data-mapping="specific"
    {% endif %}
        data-term="{{ search_term }}"
        data-reactions-enabled="1"
        data-emit-metadata="1"
        data-theme="preferred_color_scheme"
        data-lang="{{ lang }}"
        crossorigin="anonymous"
        async>
    </script>

    <p class="comment-directly-on-github">
        Instead of authenticating the <a href="https://giscus.app">giscus</a> application, you can also comment directly <a href="{{ discussion_url | safe }}"><em>on GitHub</em></a>.
    </p>
{% endmacro giscus %}
