1
0
Fork 0
color-tomato-theme/README.en.md

225 lines
8 KiB
Markdown
Raw Normal View History

2023-12-17 07:53:55 +03:00
# [Color tomato](README.md)
Two Jekyll themes to decorate static websites. The color variant was written earlier
using AngularJS and Material, this was the design of the previous version of my blog.
Then a lightweight single-color variant was written using only HTML and CSS, the
appearance resembles the default design theme on GitHub Pages. Both themes supplement
each other and are similar to each other, commonalities and differences between them
are marked in the list of features.
- Color tomato — color selection during the build.
2023-12-30 23:36:26 +03:00
- [Older tomato](https://git.org.ru/golovin/older-tomato-theme/src/branch/master/README.en.md) — lightweight decoration theme.
2023-12-17 07:53:55 +03:00
### Features
- [x] Responsive layout.
- [x] User JS and CSS files in the head block of HTML pages.
- [x] SEO-markup using JSON-LD and Open Graph.
- [x] Switch between two languages and two tomato themes.
- [x] Map of site pages with their translations in XML format.
- [x] Simple 404 page for non-existing URLs.
- [x] Fonts: Roboto for text and JBMono for code blocks.
- [x] Tomatoes: PNG, JPG 120x120, SVG 64x64, ICO 32x32.
- [ ] Color selection during the build, green is the default color.
- [ ] Scroll-to-top button in Material style.
### Colors
The theme color can be selected from the list of colors of the Material library. Each
color goes with a palette of its shades, that are used to design the entire site, green
is the default color. Only syntax highlighting in code blocks and custom JS and CSS
files are independent of color. In the old version of the blog, the palette could be
selected from a drop-down menu by a button on the client. Now the palette is selected
once at the build time — this noticeably simplifies the DOM tree and eases the client.
<details>
<summary>List of colors</summary>
- [ ] red
- [ ] pink
- [ ] purple
- [ ] deep-purple
- [ ] indigo
- [ ] blue
- [ ] light-blue
- [ ] cyan
- [ ] teal
- [x] <b>green</b>
- [ ] light-green
- [ ] lime
- [ ] yellow
- [ ] amber
- [ ] orange
- [ ] deep-orange
- [ ] brown
- [ ] grey
- [ ] blue-grey
</details>
2023-12-17 08:20:43 +03:00
### Installation
Run the script from the theme folder, build the *gem* package and install it.
```shell
rm color-tomato-theme-1.0.1.gem
gem build color-tomato-theme.gemspec
sudo gem install --local color-tomato-theme-1.0.1.gem
```
### After build
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
2024-03-31 02:22:10 +03:00
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.
2023-12-17 08:20:43 +03:00
```shell
echo "Optimization of gathered content."
cd _site || exit
cp -r assets/* .
rm -r assets
2024-03-31 02:22:10 +03:00
find . -type d -print0 | xargs -I{} -0 -n 1 cp -n return.html {}/index.html
rm -r return.html
2023-12-17 08:20:43 +03:00
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"
sed -i 's/ class="language-java highlighter-rouge"//g' "$file"
sed -i 's/ class="language-html highlighter-rouge"//g' "$file"
sed -i 's/ class="language-js highlighter-rouge"//g' "$file"
sed -i 's/ class="language-bash highlighter-rouge"//g' "$file"
sed -i 's/<div><div class="highlight"><pre class="highlight">/<div class="highlight"><pre class="highlight">/g' "$file"
sed -i 's/<\/code><\/pre><\/div><\/div>/<\/code><\/pre><\/div>/g' "$file"
sed -i -r 's/<input(.+) \/>/<input\1>/g' "$file"
sed -i -r 's/<img(.+) \/>/<img\1>/g' "$file"
done
```
### Directory structure
2023-12-17 07:53:55 +03:00
2023-12-17 08:20:43 +03:00
Folder with the Jekyll site should contain two mandatory files: with dependencies `Gemfile`
and with parameters `_config.yml` — all other files are the site content itself. This theme
is written with the expectation, that the site contents is separated into two subdirectories
by language and consist of publications and main pages, where the main pages are lists of
publications with short descriptions.
2023-12-17 07:53:55 +03:00
```
2023-12-17 08:20:43 +03:00
jekyll_site
├─ ru
│ ├─ . . . — publications
│ └─ index.md — main page
├─ en
│ ├─ . . . — publications
│ └─ index.md — main page
├─ . . .
├─ Gemfile — dependencies
└─ _config.yml — parameters
2023-12-17 07:53:55 +03:00
```
### Dependencies
`Gemfile` — a list of packages *ruby gems* to use, including locally installed ones.
```ruby
source "https://rubygems.org"
gem "jekyll"
gem "color-tomato-theme"
```
### Site parameters
`_config.yml` — a list of common parameters for the site, including parameters for the build.
```yaml
# site name for caption in footer
name: "Код с комментариями"
# footer caption for translated pages
name_translated: "Code with comments"
# URL of the site including protocol
url: "https://pomodoro.example.ru"
# subfolder of this build for relative URLs
baseurl: "/color"
# weblink in the top-left of the main pages
2023-12-30 23:36:26 +03:00
homepage_url: "https://git.org.ru/tolstoy.ln"
2023-12-17 07:53:55 +03:00
# representation of the weblink
2023-12-30 23:36:26 +03:00
homepage_name: "GIT.ORG.RU"
2023-12-17 07:53:55 +03:00
# subfolder of the alternative build,
# can be omitted, if not used
older_tomato_baseurl: ""
# time zone for ISO-8601 date format
timezone: "Europe/Moscow"
# language parameters should be specified either
# everywhere, or only on pages with translations
lang: "ru" # default, can be omitted
# author's name for SEO-markup and footer caption
author: "Толстой Л.Н."
# transliteration of the name for translated pages
author_translated: "Tolstoy L.N."
# addition to footer caption for translated pages
translation_caption: "translation from Russian"
2024-03-31 02:22:10 +03:00
# counter numbers for pages,
# can be omitted, if not used
live_internet: "abcdefghij"
2024-02-29 22:59:15 +03:00
yandex_metrika: "1234567890"
2023-12-17 08:20:43 +03:00
# design theme and color for the build
2023-12-17 07:53:55 +03:00
theme: color-tomato-theme
2023-12-17 08:20:43 +03:00
# default, can be omitted
color: green
# layout for the build
2023-12-17 07:53:55 +03:00
defaults:
- scope:
path: ""
values:
layout: default
```
### Page parameters
List of individual parameters of site pages to specify in the Front matter of the page.
```yaml
---
# page title in the page language
title: Вращаем пространственный крест
# preferably 150-160 characters in the page language
description: ниасилил, многабукаф
# comma-separated list of sections of a page in its language
sections: [Объёмные фигуры,Матрица поворота,Экспериментальная модель]
# comma-separated list of tags of a page in its language
tags: [javascript,canvas,геометрия,матрица,графика,изображение,куб]
# comma-separated list of scripts for
# this page, can be omitted, if not used
scripts: [/js/classes.js,/js/script1.js,/js/script2.js]
# comma-separated list of styles for
# this page, can be omitted, if not used
styles: [/css/pomodoro1.css,/css/pomodoro2.css]
# canonical URL of this page
canonical_url: /ru/2023/01/15/spinning-spatial-cross.html
# URL of translated page for original pages,
# or the original page for translated pages
url_translated: /en/2023/01/16/spinning-spatial-cross.html
# title of translated page for original pages,
# or the original page for translated pages
title_translated: Spinning spatial cross
2023-12-17 08:20:43 +03:00
# date parameters should be specified only on publication
2023-12-17 07:53:55 +03:00
# pages and should not be specified on main pages,
# main pages display the date the site was last built
date: 2023.01.15
# language parameters should be specified either
# everywhere, or only on pages with translations
lang: "ru" # default, can be omitted
# author's name in the page language
author: "Толстой Л.Н."
# transliteration of the author's name for original
# pages, or original author name for translated pages
author_translated: "Tolstoy L.N."
# addition to footer caption for translated pages
translation_caption: "translation from Russian"
---
```
---
2024-02-29 22:59:15 +03:00
© Golovin G.G., Code with comments, translation from Russian, 2021-2024