diff --git a/DIRECTORY_TREE.md b/DIRECTORY_TREE.md index 06c7e20..a89045f 100644 --- a/DIRECTORY_TREE.md +++ b/DIRECTORY_TREE.md @@ -57,7 +57,8 @@ │ │ │ └─ Roboto-Regular.woff │ │ ├─ 404.html │ │ ├─ favicon.ico -│ │ └─ pagesmap.xml +│ │ ├─ pagesmap.xml +│ │ └─ return.html │ ├─ Gemfile │ ├─ color-tomato-theme.gemspec │ └─ install.sh diff --git a/README.en.md b/README.en.md index 8e990e3..1b89731 100644 --- a/README.en.md +++ b/README.en.md @@ -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 diff --git a/README.md b/README.md index f513afe..0d6ffd0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/jekyll_theme/_includes/counters_body.html b/jekyll_theme/_includes/counters_body.html index 15eba69..26e69dc 100644 --- a/jekyll_theme/_includes/counters_body.html +++ b/jekyll_theme/_includes/counters_body.html @@ -1,9 +1,4 @@ +{% if site.yandex_metrika -%} - - - - + +{% endif -%} diff --git a/jekyll_theme/_includes/counters_head.html b/jekyll_theme/_includes/counters_head.html index 353cbe7..2365856 100644 --- a/jekyll_theme/_includes/counters_head.html +++ b/jekyll_theme/_includes/counters_head.html @@ -1,7 +1,19 @@ - +{% if site.live_internet -%} + + + +{% endif -%} +{% if site.yandex_metrika -%} + +{% endif -%} diff --git a/jekyll_theme/assets/return.html b/jekyll_theme/assets/return.html new file mode 100644 index 0000000..8f60154 --- /dev/null +++ b/jekyll_theme/assets/return.html @@ -0,0 +1,19 @@ +--- +layout: null +permalink: return.html +--- + + + +
+ +