1
0
Fork 0

2024-03-31

This commit is contained in:
Gennadiy 2024-03-31 02:22:10 +03:00
parent e033b08220
commit 0281633521
6 changed files with 55 additions and 18 deletions

View file

@ -57,7 +57,8 @@
│ │ │ └─ <a href='jekyll_theme/assets/resources/fonts/Roboto/Roboto-Regular.woff'>Roboto-Regular.woff</a>
│ │ ├─ <a href='jekyll_theme/assets/404.html'>404.html</a>
│ │ ├─ <a href='jekyll_theme/assets/favicon.ico'>favicon.ico</a>
│ │ └─ <a href='jekyll_theme/assets/pagesmap.xml'>pagesmap.xml</a>
│ │ ├─ <a href='jekyll_theme/assets/pagesmap.xml'>pagesmap.xml</a>
│ │ └─ <a href='jekyll_theme/assets/return.html'>return.html</a>
│ ├─ <a href='jekyll_theme/Gemfile'>Gemfile</a>
│ ├─ <a href='jekyll_theme/color-tomato-theme.gemspec'>color-tomato-theme.gemspec</a>
│ └─ <a href='jekyll_theme/install.sh'>install.sh</a>

View file

@ -70,15 +70,18 @@ sudo gem install --local color-tomato-theme-1.0.1.gem
The site can be built using the `jekyll build` command. After that, we get the `_site` folder with the
generated pages and the `assets` subfolder from the theme. We move the contents of this subfolder back
to the `_site` folder — we get shorter links, that are used in the theme. After that we bypass HTML
pages and optimize a number of tags also for shortness and for correctness. The script is intended
for this purpose.
to the `_site` folder — we get shorter links, that are used in the theme. Additionally, we copy from theme
the redirection file to the root of the site for all subdirectories, if they don't contain the `index.html`
file. After that we bypass HTML pages and optimize a number of tags also for shortness and for correctness.
The script is intended for this purpose.
```shell
echo "Optimization of gathered content."
cd _site || exit
cp -r assets/* .
rm -r assets
find . -type d -print0 | xargs -I{} -0 -n 1 cp -n return.html {}/index.html
rm -r return.html
find . -type f -name '*.html' | sort -r | while read -r file; do
sed -i 's/layout-padding=""/layout-padding/g' "$file"
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
@ -155,7 +158,9 @@ author: "Толстой Л.Н."
author_translated: "Tolstoy L.N."
# addition to footer caption for translated pages
translation_caption: "translation from Russian"
# counter number for pages
# counter numbers for pages,
# can be omitted, if not used
live_internet: "abcdefghij"
yandex_metrika: "1234567890"
# design theme and color for the build
theme: color-tomato-theme

View file

@ -70,14 +70,17 @@ sudo gem install --local color-tomato-theme-1.0.1.gem
Сборка сайта выполняется командой `jekyll build`. После этого мы получаем папку `_site` с собранными
страницами и подпапку `assets` из темы. Перемещаем содержимое этой подпапки обратно в папку `_site`
получаем короткие ссылки, которые используются в теме. После этого обходим страницы HTML и оптимизируем
ряд тегов также для краткости и для корректности. Скрипт предназначен для этой цели.
получаем короткие ссылки, которые используются в теме. Дополнительно копируем из темы файл перенаправления в
корень сайта для всех подкаталогов, если в них отсутствует файл `index.html`. После этого обходим страницы
HTML и оптимизируем ряд тегов также для краткости и для корректности. Скрипт предназначен для этой цели.
```shell
echo "Оптимизация собранного контента."
cd _site || exit
cp -r assets/* .
rm -r assets
find . -type d -print0 | xargs -I{} -0 -n 1 cp -n return.html {}/index.html
rm -r return.html
find . -type f -name '*.html' | sort -r | while read -r file; do
sed -i 's/layout-padding=""/layout-padding/g' "$file"
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
@ -134,7 +137,7 @@ name: "Код с комментариями"
name_translated: "Code with comments"
# URL адрес сайта, включая протокол
url: "https://pomodoro.example.ru"
# подпапка этой сборки для относительных URLs
# подпапка этой сборки для относительных URL-ов
baseurl: "/color"
# ссылка в верхнем левом углу заглавных страниц
homepage_url: "https://git.org.ru/tolstoy.ln"
@ -154,7 +157,9 @@ author: "Толстой Л.Н."
author_translated: "Tolstoy L.N."
# дополнение к подписи в футере для переведённых страниц
translation_caption: "translation from Russian"
# номер счётчика для страниц
# номера счётчиков для страниц, можно
# не указывать, если не используются
live_internet: "abcdefghij"
yandex_metrika: "1234567890"
# тема оформления и цвет для сборки
theme: color-tomato-theme

View file

@ -1,9 +1,4 @@
{% if site.yandex_metrika -%}
<noscript><div><img src="https://mc.yandex.ru/watch/{{- site.yandex_metrika -}}" style="position:absolute; left:-9999px;" alt=""></div></noscript>
<!-- /Yandex.Metrika counter -->
<!-- LiveInternet counter -->
<script>
new Image().src="https://counter.yadro.ru/hit?r"+escape(document.referrer)+((typeof(screen)=="undefined")
?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"
+escape(document.URL)+";h"+escape(document.title.substring(0,150))+";"+Math.random();
</script>
<!-- /LiveInternet counter -->
<!-- end yandex_metrika counter -->
{% endif -%}

View file

@ -1,7 +1,19 @@
<!-- Yandex.Metrika counter -->
{% if site.live_internet -%}
<!-- begin live_internet counter -->
<script>
new Image().src="https://counter.yadro.ru/hit;{{- site.live_internet -}}?r"+encodeURIComponent
(document.referrer)+((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+
(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"+encodeURIComponent(document.URL)
+";h"+encodeURIComponent(document.title.substring(0,150))+";"+Math.random();
</script>
<!-- end live_internet counter -->
{% endif -%}
{% if site.yandex_metrika -%}
<!-- begin yandex_metrika counter -->
<script>
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j<
document.scripts.length;j++){if(document.scripts[j].src===r){return;}}k=e.createElement(t),a=e.getElementsByTagName(t)
[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window,document,"script","https://mc.yandex.ru/metrika/tag.js",
"ym");ym({{- site.yandex_metrika -}},"init",{clickmap:true,trackLinks:true,accurateTrackBounce:true,webvisor:true});
</script>
{% endif -%}

View file

@ -0,0 +1,19 @@
---
layout: null
permalink: return.html
---
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Перенаправление&hellip;</title>
<link rel="canonical" href="{{ site.baseurl | append: '/' }}">
<script>location="{{ site.baseurl | append: '/' }}"</script>
<meta http-equiv="refresh" content="0; url={{ site.baseurl | append: '/' }}">
</head>
<body>
<h1>Перенаправление&hellip;</h1>
<a href="{{ site.baseurl | append: '/' }}">Перенаправление на заглавную страницу сайта&hellip;</a>
</body>
</html>