update script
This commit is contained in:
parent
8492c8a596
commit
87b42a0eb8
63
README.md
63
README.md
@ -90,10 +90,20 @@ lang: "en"
|
|||||||
# Plugins, implemented in ./plugins/PLUGIN_NAME
|
# Plugins, implemented in ./plugins/PLUGIN_NAME
|
||||||
# Use {{ vars.PLUGIN_NAME }} in the settings below
|
# Use {{ vars.PLUGIN_NAME }} in the settings below
|
||||||
|
|
||||||
|
# The output of the plugin can be used below, e.g., {{vars.MediumFollowersCountPlugin}}
|
||||||
plugins:
|
plugins:
|
||||||
# Automatically fetch Medium follower count
|
# Automatically fetch Medium follower count
|
||||||
- MediumFollowersCountPlugin:
|
- MediumFollowersCountPlugin:
|
||||||
username: zhgchgli
|
username: zhgchgli
|
||||||
|
# Automatically fetch Github repo star count
|
||||||
|
- GithubRepoStarsCountPlugin:
|
||||||
|
- ZhgChgLi/ZMarkupParser
|
||||||
|
- ZhgChgLi/ZReviewTender
|
||||||
|
- ZhgChgLi/ZMediumToMarkdown
|
||||||
|
- ZhgChgLi/linkyee
|
||||||
|
|
||||||
|
# Google Analytics tracking id
|
||||||
|
google_analytics_id:
|
||||||
|
|
||||||
# HTML Title
|
# HTML Title
|
||||||
title: "ZhgChgLi's Links"
|
title: "ZhgChgLi's Links"
|
||||||
@ -110,39 +120,66 @@ tagline: >-
|
|||||||
|
|
||||||
# List of links
|
# List of links
|
||||||
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
||||||
# title: The displayed text for the link
|
# text: The displayed text for the link
|
||||||
|
# title: The url title
|
||||||
# url: The URL of the link
|
# url: The URL of the link
|
||||||
# alt: Alternative text for accessibility
|
# alt: Alternative text for accessibility
|
||||||
# target: `_blank` opens in a new tab, `_self` opens in the same frame
|
# target: `_blank` opens in a new tab, `_self` opens in the same frame
|
||||||
links:
|
links:
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-medium"
|
icon: "fa-brands fa-medium"
|
||||||
title: "Tech Blog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
text: "Tech Blog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
||||||
url: "https://blog.zhgchg.li"
|
url: "https://blog.zhgchg.li"
|
||||||
alt: "ZhgChgLi's Tech Blog"
|
alt: "ZhgChgLi's Tech Blog"
|
||||||
|
title: "ZhgChgLi's Tech Blog"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-medium"
|
icon: "fa-brands fa-medium"
|
||||||
title: "Travelog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
text: "Travelog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
||||||
url: "https://medium.com/ztravel"
|
url: "https://medium.com/ztravel"
|
||||||
alt: "ZhgChgLi's Travelog"
|
alt: "ZhgChgLi's Travelog"
|
||||||
|
title: "ZhgChgLi's Travelog"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-solid fa-rss"
|
icon: "fa-solid fa-rss"
|
||||||
title: "Website"
|
text: "Website"
|
||||||
url: "https://zhgchg.li/"
|
url: "https://zhgchg.li/"
|
||||||
alt: "ZhgChgLi's Website"
|
alt: "ZhgChgLi's Website"
|
||||||
|
title: "ZhgChgLi's Website"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-instagram"
|
icon: "fa-brands fa-swift"
|
||||||
title: "Instagram"
|
text: "ZMarkupParser <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZMarkupParser']}} Stars)</span>"
|
||||||
url: "https://www.instagram.com/zhgchgli/"
|
url: "https://github.com/ZhgChgLi/ZMarkupParser"
|
||||||
alt: "ZhgChgLi's Instagram"
|
alt: "ZMarkupParser is a pure-Swift library that helps you to convert HTML strings to NSAttributedString with customized style and tags."
|
||||||
|
title: "ZMarkupParser is a pure-Swift library that helps you to convert HTML strings to NSAttributedString with customized style and tags."
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-app-store-ios"
|
||||||
|
text: "ZReviewTender <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZReviewTender']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/ZReviewTender"
|
||||||
|
alt: "ZReviewTender is a tool for fetching app reviews from the App Store and Google Play Console and integrating them into your workflow."
|
||||||
|
title: "ZReviewTender is a tool for fetching app reviews from the App Store and Google Play Console and integrating them into your workflow."
|
||||||
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-markdown"
|
||||||
|
text: "ZMediumToMarkdown <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZMediumToMarkdown']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/ZMediumToMarkdown"
|
||||||
|
alt: "ZMediumToMarkdown is a powerful tool that allows you to effortlessly download and convert your Medium posts to Markdown format."
|
||||||
|
title: "ZMediumToMarkdown is a powerful tool that allows you to effortlessly download and convert your Medium posts to Markdown format."
|
||||||
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-github"
|
||||||
|
text: "linkyee <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/linkyee']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/linkyee"
|
||||||
|
alt: "linkyee is a fully customized, open-source LinkTree alternative deployed directly on GitHub Pages."
|
||||||
|
title: "linkyee is a fully customized, open-source LinkTree alternative deployed directly on GitHub Pages."
|
||||||
|
target: "_blank"
|
||||||
|
|
||||||
|
|
||||||
# List of social media links
|
# List of social media links
|
||||||
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
||||||
# title: The displayed title for the social media link
|
# title: The url title
|
||||||
# url: The URL of the social media link
|
# url: The URL of the social media link
|
||||||
# alt: Alternative text for accessibility
|
# alt: Alternative text for accessibility
|
||||||
# target: _blank opens in a new tab, _self opens in the same frame
|
# target: _blank opens in a new tab, _self opens in the same frame
|
||||||
@ -171,6 +208,12 @@ socials:
|
|||||||
title: "ZhgChgLi's LinkedIn"
|
title: "ZhgChgLi's LinkedIn"
|
||||||
alt: "ZhgChgLi's LinkedIn"
|
alt: "ZhgChgLi's LinkedIn"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
|
- social:
|
||||||
|
icon: "fa-brands fa-instagram"
|
||||||
|
url: "https://www.instagram.com/zhgchgli/"
|
||||||
|
title: "Instagram"
|
||||||
|
alt: "ZhgChgLi's Instagram"
|
||||||
|
target: "_blank"
|
||||||
- social:
|
- social:
|
||||||
icon: "fa-solid fa-envelope"
|
icon: "fa-solid fa-envelope"
|
||||||
url: "mailto:zhgchgli@gmail.com"
|
url: "mailto:zhgchgli@gmail.com"
|
||||||
@ -185,7 +228,7 @@ footer: >
|
|||||||
# Footer copyright message
|
# Footer copyright message
|
||||||
# Linkyee is a 100% free, open-source project—feel free to modify the copyright message as you like. :)
|
# Linkyee is a 100% free, open-source project—feel free to modify the copyright message as you like. :)
|
||||||
copyright: >
|
copyright: >
|
||||||
© 2024 ZhgChgLi. Powered by <a href="https://github.com/ZhgChgLi/linkyee" target="_blank">linkyee</a>
|
© 2024 <a href="https://zhgchg.li" target="_blank">ZhgChgLi</a>. Powered by <a href="https://github.com/ZhgChgLi/linkyee" target="_blank">linkyee</a>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Please note that after each files modification, you need to wait for GitHub Actions to complete the `Automatic build` and `pages build and deployment` tasks.
|
#### Please note that after each files modification, you need to wait for GitHub Actions to complete the `Automatic build` and `pages build and deployment` tasks.
|
||||||
|
58
config.yml
58
config.yml
@ -9,10 +9,17 @@ lang: "en"
|
|||||||
# Plugins, implemented in ./plugins/PLUGIN_NAME
|
# Plugins, implemented in ./plugins/PLUGIN_NAME
|
||||||
# Use {{ vars.PLUGIN_NAME }} in the settings below
|
# Use {{ vars.PLUGIN_NAME }} in the settings below
|
||||||
|
|
||||||
|
# The output of the plugin can be used below, e.g., {{vars.MediumFollowersCountPlugin}}
|
||||||
plugins:
|
plugins:
|
||||||
# Automatically fetch Medium follower count
|
# Automatically fetch Medium follower count
|
||||||
- MediumFollowersCountPlugin:
|
- MediumFollowersCountPlugin:
|
||||||
username: zhgchgli
|
username: zhgchgli
|
||||||
|
# Automatically fetch Github repo star count
|
||||||
|
- GithubRepoStarsCountPlugin:
|
||||||
|
- ZhgChgLi/ZMarkupParser
|
||||||
|
- ZhgChgLi/ZReviewTender
|
||||||
|
- ZhgChgLi/ZMediumToMarkdown
|
||||||
|
- ZhgChgLi/linkyee
|
||||||
|
|
||||||
# Google Analytics tracking id
|
# Google Analytics tracking id
|
||||||
google_analytics_id:
|
google_analytics_id:
|
||||||
@ -32,39 +39,66 @@ tagline: >-
|
|||||||
|
|
||||||
# List of links
|
# List of links
|
||||||
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
||||||
# title: The displayed text for the link
|
# text: The displayed text for the link
|
||||||
|
# title: The url title
|
||||||
# url: The URL of the link
|
# url: The URL of the link
|
||||||
# alt: Alternative text for accessibility
|
# alt: Alternative text for accessibility
|
||||||
# target: `_blank` opens in a new tab, `_self` opens in the same frame
|
# target: `_blank` opens in a new tab, `_self` opens in the same frame
|
||||||
links:
|
links:
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-medium"
|
icon: "fa-brands fa-medium"
|
||||||
title: "Tech Blog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
text: "Tech Blog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
||||||
url: "https://blog.zhgchg.li"
|
url: "https://blog.zhgchg.li"
|
||||||
alt: "ZhgChgLi's Tech Blog"
|
alt: "ZhgChgLi's Tech Blog"
|
||||||
|
title: "ZhgChgLi's Tech Blog"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-medium"
|
icon: "fa-brands fa-medium"
|
||||||
title: "Travelog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
text: "Travelog <span class='link-button-text'>({{vars.MediumFollowersCountPlugin}} Followers)</span>"
|
||||||
url: "https://medium.com/ztravel"
|
url: "https://medium.com/ztravel"
|
||||||
alt: "ZhgChgLi's Travelog"
|
alt: "ZhgChgLi's Travelog"
|
||||||
|
title: "ZhgChgLi's Travelog"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-solid fa-rss"
|
icon: "fa-solid fa-rss"
|
||||||
title: "Website"
|
text: "Website"
|
||||||
url: "https://zhgchg.li/"
|
url: "https://zhgchg.li/"
|
||||||
alt: "ZhgChgLi's Website"
|
alt: "ZhgChgLi's Website"
|
||||||
|
title: "ZhgChgLi's Website"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
- link:
|
- link:
|
||||||
icon: "fa-brands fa-instagram"
|
icon: "fa-brands fa-swift"
|
||||||
title: "Instagram"
|
text: "ZMarkupParser <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZMarkupParser']}} Stars)</span>"
|
||||||
url: "https://www.instagram.com/zhgchgli/"
|
url: "https://github.com/ZhgChgLi/ZMarkupParser"
|
||||||
alt: "ZhgChgLi's Instagram"
|
alt: "ZMarkupParser is a pure-Swift library that helps you to convert HTML strings to NSAttributedString with customized style and tags."
|
||||||
|
title: "ZMarkupParser is a pure-Swift library that helps you to convert HTML strings to NSAttributedString with customized style and tags."
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-app-store-ios"
|
||||||
|
text: "ZReviewTender <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZReviewTender']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/ZReviewTender"
|
||||||
|
alt: "ZReviewTender is a tool for fetching app reviews from the App Store and Google Play Console and integrating them into your workflow."
|
||||||
|
title: "ZReviewTender is a tool for fetching app reviews from the App Store and Google Play Console and integrating them into your workflow."
|
||||||
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-markdown"
|
||||||
|
text: "ZMediumToMarkdown <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/ZMediumToMarkdown']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/ZMediumToMarkdown"
|
||||||
|
alt: "ZMediumToMarkdown is a powerful tool that allows you to effortlessly download and convert your Medium posts to Markdown format."
|
||||||
|
title: "ZMediumToMarkdown is a powerful tool that allows you to effortlessly download and convert your Medium posts to Markdown format."
|
||||||
|
target: "_blank"
|
||||||
|
- link:
|
||||||
|
icon: "fa-brands fa-github"
|
||||||
|
text: "linkyee <span class='link-button-text'>({{vars.GithubRepoStarsCountPlugin['ZhgChgLi/linkyee']}} Stars)</span>"
|
||||||
|
url: "https://github.com/ZhgChgLi/linkyee"
|
||||||
|
alt: "linkyee is a fully customized, open-source LinkTree alternative deployed directly on GitHub Pages."
|
||||||
|
title: "linkyee is a fully customized, open-source LinkTree alternative deployed directly on GitHub Pages."
|
||||||
|
target: "_blank"
|
||||||
|
|
||||||
|
|
||||||
# List of social media links
|
# List of social media links
|
||||||
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
# icon: Use Font Awesome icons (https://fontawesome.com/search?o=r&m=free)
|
||||||
# title: The displayed title for the social media link
|
# title: The url title
|
||||||
# url: The URL of the social media link
|
# url: The URL of the social media link
|
||||||
# alt: Alternative text for accessibility
|
# alt: Alternative text for accessibility
|
||||||
# target: _blank opens in a new tab, _self opens in the same frame
|
# target: _blank opens in a new tab, _self opens in the same frame
|
||||||
@ -93,6 +127,12 @@ socials:
|
|||||||
title: "ZhgChgLi's LinkedIn"
|
title: "ZhgChgLi's LinkedIn"
|
||||||
alt: "ZhgChgLi's LinkedIn"
|
alt: "ZhgChgLi's LinkedIn"
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
|
- social:
|
||||||
|
icon: "fa-brands fa-instagram"
|
||||||
|
url: "https://www.instagram.com/zhgchgli/"
|
||||||
|
title: "Instagram"
|
||||||
|
alt: "ZhgChgLi's Instagram"
|
||||||
|
target: "_blank"
|
||||||
- social:
|
- social:
|
||||||
icon: "fa-solid fa-envelope"
|
icon: "fa-solid fa-envelope"
|
||||||
url: "mailto:zhgchgli@gmail.com"
|
url: "mailto:zhgchgli@gmail.com"
|
||||||
|
44
plugins/GithubRepoStarsCountPlugin.rb
Normal file
44
plugins/GithubRepoStarsCountPlugin.rb
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
require_relative 'Plugin'
|
||||||
|
require 'net/http'
|
||||||
|
require 'nokogiri'
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
|
class GithubRepoStarsCountPlugin < Plugin
|
||||||
|
attr_reader :data, :repos
|
||||||
|
|
||||||
|
def initialize(data)
|
||||||
|
@data = data
|
||||||
|
|
||||||
|
repos = {}
|
||||||
|
data[0].each do |repo|
|
||||||
|
repos[repo] = 0
|
||||||
|
end
|
||||||
|
@repos = repos
|
||||||
|
end
|
||||||
|
|
||||||
|
def execute
|
||||||
|
|
||||||
|
repos.each do |repo, value|
|
||||||
|
repos[repo] = load_repo_stars(repo)
|
||||||
|
end
|
||||||
|
|
||||||
|
return repos
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_repo_stars(repo)
|
||||||
|
uri = URI("https://github.com/#{repo}")
|
||||||
|
|
||||||
|
response = Net::HTTP.get_response(uri)
|
||||||
|
case response
|
||||||
|
when Net::HTTPSuccess then
|
||||||
|
document = Nokogiri::HTML(response.body)
|
||||||
|
stargazers_count_element = document.at('span#repo-stars-counter-star')
|
||||||
|
stargazers_count = stargazers_count_element&.text
|
||||||
|
|
||||||
|
return stargazers_count || 0
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -69,6 +69,7 @@ if !settings["links"].nil?
|
|||||||
settings["links"][index]["link"]["url"] = Liquid::Template.parse(settings["links"][index]["link"]["url"]).render(settings)
|
settings["links"][index]["link"]["url"] = Liquid::Template.parse(settings["links"][index]["link"]["url"]).render(settings)
|
||||||
settings["links"][index]["link"]["alt"] = Liquid::Template.parse(settings["links"][index]["link"]["alt"]).render(settings)
|
settings["links"][index]["link"]["alt"] = Liquid::Template.parse(settings["links"][index]["link"]["alt"]).render(settings)
|
||||||
settings["links"][index]["link"]["title"] = Liquid::Template.parse(settings["links"][index]["link"]["title"]).render(settings)
|
settings["links"][index]["link"]["title"] = Liquid::Template.parse(settings["links"][index]["link"]["title"]).render(settings)
|
||||||
|
settings["links"][index]["link"]["text"] = Liquid::Template.parse(settings["links"][index]["link"]["text"]).render(settings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<div class="links">
|
<div class="links">
|
||||||
{% for item in links %}
|
{% for item in links %}
|
||||||
{% assign link = item.link %}
|
{% assign link = item.link %}
|
||||||
<a href="{{ link.url }}" target="{{ link.target }}" class="link-button" alt="{{ link.alt }}">
|
<a href="{{ link.url }}" target="{{ link.target }}" class="link-button" alt="{{ link.alt }}" title="{{ link.title }}">
|
||||||
<i class="{{ link.icon }}"></i> {{ link.title }}
|
<i class="{{ link.icon }}"></i> {{ link.text }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
{% for item in socials %}
|
{% for item in socials %}
|
||||||
{% assign social = item.social %}
|
{% assign social = item.social %}
|
||||||
<a href="{{ social.url }}" target="{{ social.target }}" class="icon-button" alt="{{ social.alt }}">
|
<a href="{{ social.url }}" title="{{ social.title }}" target="{{ social.target }}" class="icon-button" alt="{{ social.alt }}">
|
||||||
<i class="{{ social.icon }}"></i>
|
<i class="{{ social.icon }}"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -43,13 +43,13 @@
|
|||||||
<script src="fontawesome/js/all.js" data-auto-replace-svg="nest"></script>
|
<script src="fontawesome/js/all.js" data-auto-replace-svg="nest"></script>
|
||||||
{% if google_analytics_id %}
|
{% if google_analytics_id %}
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_id }}"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S7G4LWWHH8"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', '{{ google_analytics_id }}');
|
gtag('config', 'G-S7G4LWWHH8');
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script src="./scripts.js"></script>
|
<script src="./scripts.js"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user