Add pagefond

This commit is contained in:
Digital Studium 2023-07-25 10:45:30 +03:00
parent 942fc7a6a9
commit 91235f35ce
9 changed files with 54 additions and 17 deletions

View File

@ -70,7 +70,9 @@ button {
width: 30%; width: 30%;
} }
p.lang {
margin: 0;
}
/* Блок для правильной вёрстки аудио/видео начало */ /* Блок для правильной вёрстки аудио/видео начало */
/* Применяем max-width для замещаемых элементов и контролов формы. */ /* Применяем max-width для замещаемых элементов и контролов формы. */
@ -126,6 +128,11 @@ body {
grid-template-columns: repeat(6, 1fr); grid-template-columns: repeat(6, 1fr);
} }
header {
display: grid;
align-content: space-between;
}
header, header,
footer, footer,
main { main {
@ -138,6 +145,14 @@ main {
justify-self: end; justify-self: end;
} }
#search {
grid-column-start: 4;
grid-column-end: 5;
justify-self: end;
align-self: end;
grid-row-end: 2
}
footer, footer,
main { main {
grid-column-end: 5 grid-column-end: 5
@ -173,8 +188,11 @@ main,
@media screen and (max-width:50em) { @media screen and (max-width:50em) {
header, header {
main { grid-column-end: 4;
}
main, #search {
grid-column-end: 7 grid-column-end: 7
} }
} }

View File

@ -23,6 +23,9 @@
{% endif %} {% endif %}
</main> </main>
{% include "components/social.j2" %} {% include "components/social.j2" %}
{% if config.pagefind %}
{% include "components/search.j2" %}
{% endif %}
{% include "components/sidebar.j2" %} {% include "components/sidebar.j2" %}
{% include "components/footer.j2" %} {% include "components/footer.j2" %}
{% include "components/script.j2" %} {% include "components/script.j2" %}

View File

@ -1,13 +1,12 @@
<p class="lang">
{% if home %} {% if home %}
<p>&#127760; &#127760;
{% for key, value in config.languages.items() %} {% for key, value in config.languages.items() %}
{% if key != language %} {% if key != language %}
<a href="/{{ key }}">{{ value.language_name }}</a> <a href="/{{ key }}">{{ value.language_name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p>
{% else %} {% else %}
<p>
&#127760; &#127760;
{% for key, value in config.languages.items() %} {% for key, value in config.languages.items() %}
{% if key != language %} {% if key != language %}
@ -15,5 +14,5 @@
value.language_name }}</a> value.language_name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p>
{% endif %} {% endif %}
</p>

View File

@ -1,5 +1,5 @@
<header> <header>
<a href="/{{ language }}"> <a href="/{{ language }}/">
<img src="/logo.svg" alt="{{ config['languages'][language]['title'] }}" /> <img src="/logo.svg" alt="{{ config['languages'][language]['title'] }}" />
<h3>{{ config['languages'][language]['description'] }}</h3> <h3>{{ config['languages'][language]['description'] }}</h3>
</a> </a>

View File

@ -1,6 +1,6 @@
<article> <article>
<h2> <h2>
<a class="index-title" href="/{{ language }}{{ url }}" rel="permalink" title="{{ post.title }}">{{ post.title }}</a> <a class="index-title" href="/{{ language }}{{ url }}/" rel="permalink" title="{{ post.title }}">{{ post.title }}</a>
</h2> </h2>
{% include "components/author_and_date.j2" %} {% include "components/author_and_date.j2" %}
{% include "components/image.j2" %} {% include "components/image.j2" %}

View File

@ -0,0 +1,16 @@
<div id="search"></div>
<link href="/_pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/_pagefind/pagefind-ui.js" type="text/javascript"></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI(
{
element: "#search",
translations: {
"placeholder": "",
"clear_search": ""
}
}
);
});
</script>

View File

@ -3,7 +3,7 @@
{% for section, urls in posts[language].items() %} {% for section, urls in posts[language].items() %}
{% if section != "/" %} {% if section != "/" %}
<p> <p>
<a href="/{{ language}}/{{ section }}">{{ translate(section, language) }} ({{ urls | length }})</a> <a href="/{{ language}}/{{ section }}/">{{ translate(section, language) }} ({{ urls | length }})</a>
</p> </p>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -1,7 +1,8 @@
<article> <article data-pagefind-body>
<h1>{{ post.title }}</h1> <header>
<h1>{{ post.title }}</h1>
</header>
{% include "components/author_and_date.j2" %} {% include "components/author_and_date.j2" %}
{% include "components/image.j2" %} {% include "components/image.j2" %}
{{ post.content }} {{ post.content }}
</article> </article>