Skip to content

Commit

Permalink
Добавляет OG-картинку для раздела (#1163)
Browse files Browse the repository at this point in the history
* Корректирует название разделов

* Удаляет лишний параметр

* Добавляет заголовок для индекса

* Исправляет OG-картинки и стили для индекса

* Подправляет надписи для обложек

* Добавляет обложку для страницы со всеми статьями
  • Loading branch information
igsekor authored Sep 6, 2023
1 parent 64c7c91 commit 3580712
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 33 deletions.
17 changes: 13 additions & 4 deletions src/includes/blocks/social-card.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{% macro socialCard(category, categoryName, docPath, cover) %}
{% macro socialCard(category, categoryName, cover, isIndex) %}
<div class="social-card">
<section class="social-card__slogan">
<section class="social-card__slogan-wrapper">
<div class="social-card__title">Дока</div>
{% if category == "recipes" %}
<div class="social-card__moto">гид по рецептам<br>веб-разработки</div>
{% if category == "a11y" %}
<div class="social-card__moto">твой гид по доступности</div>
{% elif category == "all" %}
<div class="social-card__moto">твой гид по<br>веб-разработке</div>
{% elif category == "recipes" %}
<div class="social-card__moto">твой гид по рецептам<br>веб-разработки</div>
{% elif category == "tools" %}
<div class="social-card__moto">гид по инструментам</div>
<div class="social-card__moto">твой гид по<br>веб-платформе</div>
{% else %}
<div class="social-card__moto">твой гид по {{ categoryName }}</div>
{% endif %}
Expand All @@ -28,6 +32,11 @@
</div>
{% endif %}
</div>
{% if isIndex %}
<div class="social-card__index-title">
{{ categoryName }}
</div>
{% endif %}
</section>

<section class="social-card__site">
Expand Down
4 changes: 3 additions & 1 deletion src/styles/blocks/social-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
justify-items: end;
}

.social-card__title {
.social-card__title,
.social-card__index-title {
--stroke-width: 2px;
font-family: 'Spot Mono', monospace;
font-size: calc(100vw * var(--title-font-size-proportion));
Expand Down Expand Up @@ -72,6 +73,7 @@
grid-row-start: 1;
grid-row-end: -1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: var(--accent-color);
Expand Down
5 changes: 5 additions & 0 deletions src/views/sc-all.11tydata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
title: 'Все статьи',
layout: 'base.njk',
permalink: '/all/index.sc.html',
}
12 changes: 12 additions & 0 deletions src/views/sc-all.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html class="base font-theme" lang="{{ meta.lang }}" itemscope itemtype="https://schema.org/{{ pageType }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../styles/index.sc.css">
</head>
<body class="base__body {{ bodyClass }}">
{% from "blocks/social-card.njk" import socialCard %}
{{ socialCard('all', 'Все статьи', cover, true) }}
</body>
</html>
29 changes: 2 additions & 27 deletions src/views/sc-index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,10 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<link rel="stylesheet" href="../styles/index.sc.css">
<link rel="stylesheet" href="../styles/dark-theme.css" media="(prefers-color-scheme: dark)">
</head>
<body class="base__body {{ bodyClass }}">

{% from "blocks/logo.njk" import logo %}

{% set isLogoContrastColor = hasCategory %}

<div class="index-block" style="--accent-color: var(--color-{{ category }})">
<div class="index-block__header">
<h1 class="index-block__title">
Статьи раздела «{{ categoryName }}» по алфавиту
</h1>
</div>

<main style="display:grid;grid-template-column:1200px 1024px;grid-gap:24px;grid-auto-rows:1024px;">
{% for letter in firstLettersOfArticles %}
{% from "blocks/social-card.njk" import socialCard %}
{% for articleId in categoryArticlesByAlphabet[letter] %}
<iframe src="{{ articleId }}/index.sc.html" height="630" width="1200" styles="display:block;">
</iframe>
<iframe src="{{ articleId }}/index.sc.html" height="1024" width="1024" styles="display:block;">
</iframe>
{% endfor %}
{% endfor %}
</main>
</div>

{% from "blocks/social-card.njk" import socialCard %}
{{ socialCard(category, categoryName, cover, true) }}
</body>
</html>
2 changes: 1 addition & 1 deletion src/views/sc.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
</head>
<body class="base__body {{ bodyClass }}">
{% from "blocks/social-card.njk" import socialCard %}
{{ socialCard(category, categoryName, docPath, cover) }}
{{ socialCard(category, categoryName, cover) }}
</body>
</html>

0 comments on commit 3580712

Please sign in to comment.