Compare commits

...

2 Commits

Author SHA1 Message Date
Digital Studium 9bba1d2c70 Fix social and schema 2023-07-23 15:53:48 +03:00
Digital Studium 13613a593f Refactor 2023-07-23 11:47:23 +03:00
9 changed files with 53 additions and 44 deletions

View File

@ -39,7 +39,7 @@ function addCopyButtons(clipboard) {
// wrapper.appendChild(preElement); // wrapper.appendChild(preElement);
var preParent = preElement.parentNode; var preParent = preElement.parentNode;
if (preParent.classList.contains('highlight') && preElement.children[0].dataset.lang != 'plaintext') { if (preParent.classList.contains('codehilite') && preElement.children[0].dataset.lang != 'plaintext') {
preParent.parentNode.insertBefore(button, preParent); preParent.parentNode.insertBefore(button, preParent);
} }
}); });

View File

@ -1,3 +1,12 @@
{% set title = config.languages[language].title %}
{% set description = config.languages[language].description %}
{% if section %}
{% set title = translate(section, language) | capitalize %}
{% set description = title %}
{% elif not home %}
{% set title = post.title %}
{% set description = post.description %}
{% endif %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ language }}"> <html lang="{{ language }}">
{% include "components/head.j2" %} {% include "components/head.j2" %}
@ -13,6 +22,7 @@
{% include "components/single.j2" %} {% include "components/single.j2" %}
{% endif %} {% endif %}
</main> </main>
{% include "components/social.j2" %}
{% 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,18 +1,11 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{% set title = config.languages[language].title %}
{% set description = config.languages[language].description %}
{% if section %}
{% set title = (translate(section, language) | capitalize) + " | " + title %}
{% set description = title %}
{% elif not home %}
{% set title = post.title + " | " + title %}
{% set description = post.description %}
{% endif %}
<title>{{ title }}</title> <title>{{ title }}</title>
<meta name="title" content="{{ title }}" /> <meta name="title" content="{{ title }}" />
<meta name="description" content="{{ description }}" /> <meta name="description" content="{{ description }}" />
<link href="/css/style.css" rel="stylesheet"> <link href="/css/style.css" rel="stylesheet">
{% if config.custom_css %}<link href="/css/{{ config.custom_css }}" rel="stylesheet">{% endif %} {% if config.custom_css %}
<link href="/css/{{ config.custom_css }}" rel="stylesheet">
{% endif %}
</head> </head>

View File

@ -1,5 +1,7 @@
{% for section, urls in posts[language].items() %} {% for section, urls in posts[language].items() %}
{% if section != "/" %}
{% for url, post in urls.items() %} {% for url, post in urls.items() %}
{% include "components/post_summary.j2" %} {% include "components/post_summary.j2" %}
{% endfor %} {% endfor %}
{% endif %}
{% endfor %} {% endfor %}

View File

@ -4,9 +4,9 @@
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "WebSite", "@type": "WebSite",
"name": "{{ title }}", "name": "{{ title }}",
"url": "{{ url }}", "url": "{{ config.base_url }}",
"description": "{{ description }}", "description": "{{ description }}",
"thumbnailUrl": "{{ logo_url }}", "thumbnailUrl": "{{ config.base_url + "/logo.svg" }}",
} }
</script> </script>
{% else %} {% else %}
@ -14,29 +14,31 @@
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": {{ config.schema.type }}, "@type": {{ config.schema.type }},
{# "articleSection": {{ translate(section, language) }}, #} {% if section %}
"articleSection": {{ translate(section, language) }},
{% endif %}
{% if config.schema.type == 'TechArticle' %} {% if config.schema.type == 'TechArticle' %}
"proficiencyLevel": "Beginner", "proficiencyLevel": "Beginner",
{% endif %} {% endif %}
"name": {{ title }}, "name": {{ title }},
"headline": {{ title }}, "headline": {{ title }},
"inLanguage": {{ language }}, "inLanguage": {{ language }},
"wordCount": {{ wordcount }}, "description": {{ description | striptags }},
"description": {{ description }},
"datePublished": {{ date_published }}, "datePublished": {{ date_published }},
"dateModified": {{ date_modified }}, "dateModified": {{ date_modified }},
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": {{ config.languages[language].author }}, "name": {{ config.languages[language].author }},
"url": {{ config.baseURL + "/" + language + "/about-author" }} "url": {{ config.base_url + "/" + language + "/about-author" }}
}, },
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": "{{ config.languages[language].title }}", "name": "{{ config.languages[language].title }}",
"url": {{ config.baseUrl }}, "url": {{ config.base_url }},
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ logo_url }} "url": {{ config.base_url + "/logo.svg" }}
} }
} }
} }

View File

@ -1,3 +1,3 @@
{% for include in includes %} {% for include in config['includes'] %}
<script defer src="/js/{{ include }}"></script> <script defer src="/js/{{ include }}"></script>
{% endfor %} {% endfor %}

View File

@ -1,9 +1,11 @@
<div class="sidebar"> <div class="sidebar">
<section> <section>
{% for section, urls in posts[language].items() %} {% for section, urls in posts[language].items() %}
{% 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 %}
{% endfor %} {% endfor %}
</section> </section>
</div> </div>

View File

@ -1,20 +1,20 @@
<div class="social-icons"> <div class="social-icons">
{{ if .Site.Params.youtube }} {% if config.languages[language].youtube %}
<a href="https://youtube.com/{{ .Site.Params.Youtube }}"> <a href="https://youtube.com/{{ config.languages[language].youtube }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/youtube.svg" | base64Encode }}" <img src="/images/youtube.svg"
alt="{{ .Site.Title }}" width="100" /> alt="{{ config.languages[language].title }}" width="100" />
</a> </a>
{{ end }} {% endif %}
{{ if .Site.Params.github }} {% if config.languages[language].github %}
<a href="https://github.com/{{ .Site.Params.Github }}"> <a href="https://github.com/{{ config.languages[language].github }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/github.svg" | base64Encode }}" <img src="/images/github.svg"
alt="{{ .Site.Title }}" width="100" /> alt="{{ config.languages[language].title }}" width="100" />
</a> </a>
{{ end }} {% endif %}
{{ if .Site.Params.telegram }} {% if config.languages[language].telegram %}
<a href="https://t.me/{{ .Site.Params.Telegram }}"> <a href="https://t.me/{{ config.languages[language].telegram }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/telegram.svg" | base64Encode }}" <img src="/images/telegram.svg"
alt="{{ .Site.Title }}" width="100" /> alt="{{ config.languages[language].title }}" width="100" />
</a> </a>
{{ end }} {% endif %}
</div> </div>