Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
lartie committed Oct 11, 2022
0 parents commit 9d41f40
Show file tree
Hide file tree
Showing 175 changed files with 5,203 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.102.3
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./public

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "themes/hugo-book"]
path = themes/hugo-book
url = https://github.com/alex-shpak/hugo-book
Empty file added .hugo_build.lock
Empty file.
6 changes: 6 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

127 changes: 127 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
baseURL: 'http://example.org/'
languageCode: 'ru-RU'
title: 'inoshipotyanin'
defaultContentLanguage: 'ru'
theme: 'hugo-book'
copyright: Everything is mine
enableGitInfo: true

languages:
ru:
languageName: Русский
title: Вкорячиваем
contentDir: content/ru
weight: 2

params:
# (Optional, default light) Sets color theme: light, dark or auto.
# Theme 'auto' switches between dark and light modes based on browser/os preferences
BookTheme: "light"

# (Optional, default true) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
BookToC: true

# (Optional, default none) Set the path to a logo for the book. If the logo is
# /static/logo.png then the path would be logo.png
BookLogo: logo.svg

# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle: /menu

# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'
# BookSection: '/nothing'

# Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links.
# BookRepo: https://github.com/lartie/blog

# (Optional, default 'commit') Specifies commit portion of the link to the page's last modified
# commit hash for 'doc' page type.
# Requires 'BookRepo' param.
# Value used to construct a URL consisting of BookRepo/BookCommitPath/<commit-hash>
# Github uses 'commit', Bitbucket uses 'commits'
# BookCommitPath: commit

# Enable "Edit this page" links for 'doc' page type.
# Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
# Edit path must point to root directory of repo.
BookEditPath: edit/main/exampleSite

# Configure the date format used on the pages
# - In git information
# - In blog posts
BookDateFormat: "January 2, 2006"

# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
# Configuration for indexing can be adjusted in i18n folder per language.
BookSearch: true

# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookComments: true

# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
# Theme will print warning if page referenced in markdown does not exists.
BookPortableLinks: true

# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
BookServiceWorker: true

# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables a drop-down menu for translations only if a translation is present.
BookTranslatedOnly: false

Repository:
Title: Репозиторий
Url: lartie/blog

Comments:
Provider: giscus
Commentable:
Page: true
Post: true
Docs: false
Project: false
Publication: true
Talk: false
Giscus:
Repo: lartie/blog
RepoId: R_kgDOILtzew
Category: Comments
CategoryId: DIC_kwDOILtze84CR6g_
Mapping: title
Label: comment
Theme: light
ReactionsEnabled: 1
EmitMetadata: 0
InputPosition: top
Language: ru
CrossOrigin: anonymous

Contacts:
Title: Контакты
Items:
- name: "Telegram"
url: "https://t.me/lartie"
logo: "/social/telegram.svg"
- name: "GitHub"
url: "https://github.com/lartie"
logo: "/social/github.svg"
- name: "LinkedIn"
url: "https://www.linkedin.com/in/lartie/"
logo: "/social/linkedin.svg"

Sponsor:
Title: Спонсор
Url:
28 changes: 28 additions & 0 deletions content/ru/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Введение
type: blog
bookComments: false
---

{{ define "main" }}
{{ range sort .Paginator.Pages }}
<article class="markdown book-post">
<h2>
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h2>
{{ partial "docs/post-meta" . }}
<p>
{{- .Summary -}}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">...</a>
{{ end }}
</p>
</article>
{{ end }}

{{ template "_internal/pagination.html" . }}
{{ end }}

{{ define "toc" }}
{{ partial "docs/taxonomy" . }}
{{ end }}
37 changes: 37 additions & 0 deletions content/ru/posts/go-embed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
date: 2022-10-11
linktitle: Расширяем возможности go:embed
menu:
main:
parent: /
prev: /
title: Расширяем возможности go:embed
weight: 10
tags:
- "go"
- "golang"
- "embed"
- "development"
categories:
- "internals"
- "golang"

summary: |
В этой статье мы рассмотрим текущие возможности директивы для компилятора [go:embed](https://pkg.go.dev/embed), чего в ней не хватает и как добавить свои изменения.
---

## **Введение**

Представим ситуацию когда мы хотим встроить файлы в наше приложение на go, например, шаблоны для кодогенерации или статику для http сервера, вот тогда и приходит на помощь директива [go:embed](https://pkg.go.dev/embed).

Описать что это такое, зачем и почему этим пользуются

## **Текущая проблема**

Описать приемущества и недостатки текущей реализации

## **Простое решение**
Показать как можно решить проблему не меняя самого языка

## **Решение с ковырянием исходного кода**

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/lartie/blog

go 1.19
23 changes: 23 additions & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ define "main" }}

{{ partial "welcome" . }}

{{ range sort .Paginator.Pages }}
<article class="markdown book-post">
<h2>
<a style="color: black" href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h2>
{{ partial "docs/summary-meta" . }}
<p>
{{- .Summary -}}
<i> <a href="{{ .RelPermalink }}">читать далее »</a></i>
</p>
</article>
{{ end }}

{{ template "_internal/pagination.html" . }}
{{ end }}

{{ define "toc" }}
{{ partial "docs/taxonomy" . }}
{{ end }}
1 change: 1 addition & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ define "dummy" }}{{ end }}
15 changes: 15 additions & 0 deletions layouts/partials/docs/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ if site.Params.Comments.Giscus }}
<h2><b>Комментарии</b></h2>
<script src="https://giscus.app/client.js"
data-repo="{{site.Params.Comments.Giscus.Repo}}"
data-repo-id="{{site.Params.Comments.Giscus.RepoId}}"
data-category="{{site.Params.Comments.Giscus.Category}}"
data-category-id="{{site.Params.Comments.Giscus.CategoryId}}"
data-mapping="{{site.Params.Comments.Giscus.Mapping}}"
data-reactions-enabled="{{site.Params.Comments.Giscus.ReactionsEnabled}}"
data-theme="{{site.Params.Comments.Giscus.Theme}}"
crossorigin="{{site.Params.Comments.Giscus.CrossOrigin}}"
async>
</script>
<noscript>Please enable JavaScript to view the comments powered by giscus.</noscript>
{{ end }}
16 changes: 16 additions & 0 deletions layouts/partials/docs/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="flex align-center justify-between">
<label for="menu-control">
<img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
</label>

<strong>{{ partial "docs/title" . }}</strong>

<label for="toc-control">
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
<img src="{{ "svg/toc.svg" | relURL }}" class="book-icon" alt="Table of Contents" />
{{ end }}
</label>

<!-- repository card -->
<script src="https://tarptaeya.github.io/repo-card/repo-card.js"></script>
</div>
17 changes: 17 additions & 0 deletions layouts/partials/docs/inject/menu-after.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<br>
{{ if site.Params.Contacts.Items }}
<h3><b>{{ site.Params.Contacts.Title }}</b></h3>
<div class="contacts">
<div style="margin: auto">
{{ range site.Params.Contacts.Items }}
<a href="{{ .url }}" target="_blank">
<img width="13%" src="{{ .logo }}" alt="{{ .name }}" class="contact-icon">
</a>
{{ end }}
</div>
</div>
{{ end }}
{{ if site.Params.Repository }}
<h3><b>{{ site.Params.Repository.Title }}</b></h3>
<div class="repo-card" data-repo="{{ site.Params.Repository.Url }}"></div>
{{ end }}
23 changes: 23 additions & 0 deletions layouts/partials/docs/post-meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ with .Date }}
<h5>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</h5>
{{ end }}

{{ range $taxonomy, $_ := .Site.Taxonomies }}
{{ with $terms := $.GetTerms $taxonomy }}
<div>
{{ range $n, $term := $terms }}{{ if $n }}, {{ end }}
<a href="{{ $term.RelPermalink }}">{{ $term.Title }}</a>
{{- end }}
</div>
{{ end }}
{{ end }}

{{ if .Params.image }}
<p>
{{ with .Resources.GetMatch .Params.image }}
<img src={{ .RelPermalink }} />
{{ else }}
<img src={{ .Params.image | relURL }} />
{{ end }}
</p>
{{ end }}
3 changes: 3 additions & 0 deletions layouts/partials/docs/sponsor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ if site.Params.Sponsor }}
<h2><b>Спонсировать</b></h2>
{{ end }}
3 changes: 3 additions & 0 deletions layouts/partials/docs/subscribe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ if site.Params.Subscribe }}
<h2><b>Подписаться на email рассылку</b></h2>
{{ end }}
Loading

0 comments on commit 9d41f40

Please sign in to comment.