Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавляет поддержку ссылок на Telegram для страницы автора #995

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/views/person.11tydata.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ module.exports = {
return person.data.url.replace(pattern, '')
},

telegramId: function (data) {
const { person } = data
const pattern = new RegExp('^(http|https)://(www.)?t.me/')
return person.data.url.replace(pattern, '')
},

photo: function (data) {
const { person } = data
return person.data.photo
Expand Down
11 changes: 11 additions & 0 deletions src/views/person.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% set behanceRegEx = r/behance.net/g %}
{% set githubRegEx = r/github.com/g %}
{% set twitterRegEx = r/twitter.com/g %}
{% set telegramRegEx = r/t.me/g %}

{% set behanceIcon %}
<svg class="person-links-list__icon" width="13" height="9" viewBox="0 0 13 9" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
Expand All @@ -24,6 +25,13 @@
</svg>
{% endset %}

{% set telegramIcon %}
<svg class="person-links-list__icon" width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle fill="#2AABEE" cx="5.5" cy="5.5" r="5.5"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.48961 5.44194C4.09297 4.74338 5.16213 4.28285 5.69709 4.06034C7.2245 3.42504 7.54188 3.31468 7.74875 3.31104C7.79424 3.31024 7.89597 3.32151 7.96187 3.37498C8.01751 3.42013 8.03282 3.48112 8.04015 3.52393C8.04747 3.56674 8.0566 3.66425 8.04935 3.74045C7.96657 4.61013 7.60843 6.72061 7.42622 7.69467C7.34912 8.10683 7.19732 8.24502 7.05035 8.25855C6.73095 8.28794 6.48842 8.04747 6.17907 7.84469C5.695 7.52737 5.42153 7.32984 4.95165 7.0202C4.40863 6.66236 4.76065 6.46568 5.07011 6.14425C5.1511 6.06014 6.55837 4.78012 6.5856 4.664C6.58901 4.64948 6.59217 4.59535 6.56001 4.56676C6.52785 4.53818 6.48039 4.54796 6.44614 4.55573C6.39759 4.56675 5.62428 5.07788 4.12621 6.08912C3.9067 6.23985 3.70789 6.31328 3.52975 6.30944C3.33337 6.30519 2.95562 6.1984 2.6748 6.10712C2.33036 5.99515 2.05661 5.93596 2.08045 5.74581C2.09286 5.64677 2.22925 5.54548 2.48961 5.44194Z" fill="#FFF"/>
</svg>
{% endset %}

{% set issuesIcon %}
<svg class="person-links-list__icon" width="10" height="10" viewBox="0 0 10 10">
<circle cx="5" cy="5" r="4.5" stroke="currentColor" fill="none"/>
Expand Down Expand Up @@ -72,6 +80,9 @@
{% elif behanceRegEx.test(url) %}
{{ behanceIcon | safe }}
<span>{{ behanceId }}</span>
{% elif telegramRegEx.test(url) %}
{{ telegramIcon | safe }}
<span>{{ telegramId }}</span>
{% endif %}
</a>
</li>
Expand Down