This commit is contained in:
fruworg 2023-07-31 22:30:53 +06:00
parent 5dc99c0e0a
commit 09b20ec949
3 changed files with 6 additions and 38 deletions

View File

@ -40,6 +40,7 @@ baseURL = "https://<имя>.github.io"
languageCode = "en-us"
title = "<имя>"
theme="themu"
# Подсветка кода
pygmentsstyle = "monokai"
pygmentscodefences = true
@ -48,6 +49,7 @@ pygmentscodefencesguesssyntax = true
paginate=3 # статей на страницу
[params]
subtitleFile = true
subtitle = "Минимальная и чистая [тема блога для Hugo](https://github.com/fruworg)"
# Социальные ссылки

View File

@ -8,9 +8,10 @@
<main class="list">
<div class="site-description">
{{- if isset .Site.Params "description" -}}
<pre>{{ template "partials/subtitle.html" . }}</pre>
<script src="{{ .Site.BaseURL }}js/clock.js"></script>
{{- if .Param "subtitleFile" -}}
{{ template "partials/subtitle.html" . }}
{{- else if isset .Site.Params "subtitle" -}}
<p>{{ .Site.Params.Subtitle | markdownify }}</p>
{{- end -}}
</div>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}

View File

@ -1,35 +0,0 @@
// Функция для форматирования числа (добавляет ведущий ноль, если число меньше 10)
function formatNumber(num) {
return num < 10 ? '0' + num : num;
}
// Функция для получения текущего времени и дgkgаты в поясе UTC+6
function getCurrentDateTimeUTCPlus6() {
const currentTime = new Date();
const offset = currentTime.getTimezoneOffset(); // Получаем разницу в минутах между UTC и локальным временем
const utcPlus6DateTime = new Date(currentTime.getTime() + 6 * 60 * 60 * 1000); // Добавляем 6 часов к UTC+0
return utcPlus6DateTime;
}
// Функция для обновления времени и даты на странице
function updateClock() {
const timeElement = document.getElementById('time');
if (timeElement) {
const currentDateTime = getCurrentDateTimeUTCPlus6();
const date = formatNumber(currentDateTime.getUTCDate());
const month = formatNumber(currentDateTime.getUTCMonth() + 1);
const year = currentDateTime.getUTCFullYear().toString().slice(-2); // Получаем последние две цифры года
const hours = formatNumber(currentDateTime.getUTCHours());
const minutes = formatNumber(currentDateTime.getUTCMinutes());
const seconds = formatNumber(currentDateTime.getUTCSeconds());
const dateTimeString = `${date}.${month}.${year} ${hours}:${minutes}:${seconds} UTC+6`;
timeElement.innerText = dateTimeString;
}
}
// Обновляем время и дату каждую секунду
setInterval(updateClock, 1000);
// Вызываем функцию для первоначального обновления времени и даты
updateClock();