Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Oct 21, 2024
1 parent ccc9182 commit 207fda4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ install: docs/CNAME
pip install mkdocs-git-revision-date-localized-plugin
pip install mkdocs-git-authors-plugin
pip3 install mkdocs-exclude
pip install mkdocs-rss-plugin

tutorial:
git clone https://github.com/eunomia-bpf/bpf-developer-tutorial tutorial --depth=1
Expand Down
21 changes: 21 additions & 0 deletions hooks/socialmedia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from textwrap import dedent
import urllib.parse
import re

x_intent = "https://x.com/intent/tweet"
fb_sharer = "https://www.facebook.com/sharer/sharer.php"
# include = re.compile(r"blog/[1-9].*")

def on_page_markdown(markdown, **kwargs):
page = kwargs['page']
config = kwargs['config']
# if not include.match(page.url):
# return markdown

page_url = config.site_url+page.url
page_title = urllib.parse.quote(page.title+'\n')

return markdown + "\n\n" + dedent(f"""
[Share on :simple-x:]({x_intent}?text={page_title}&url={page_url}){{ .md-button }}
[Share on :simple-facebook:]({fb_sharer}?u={page_url}){{ .md-button }}
""")
2 changes: 1 addition & 1 deletion material/overrides/comments.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if page.meta.comments %}
{% if true %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<!-- Insert generated snippet here -->
<script src="https://giscus.app/client.js"
Expand Down
7 changes: 7 additions & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ markdown_extensions:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg

hooks:
- hooks/socialmedia.py

extra:
social:
- icon: fontawesome/brands/github
Expand Down

0 comments on commit 207fda4

Please sign in to comment.