Skip to content

Commit

Permalink
More macros tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCalvin committed Feb 16, 2025
1 parent 6cea624 commit 8a4d5e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import os
from datetime import datetime

def define_env(env):
"""
This hook is called when the config is loading.
"""
# Get environment variables with fallbacks
username = os.getenv('GITHUB_REPOSITORY_OWNER', 'Ghost')
repo_name = os.getenv('GITHUB_REPOSITORY', 'mkdocs-plex-guide-template').split('/')[-1]
current_year = datetime.now().year

# Add them to the macros environment
env.variables.update({
"username": username,
"repo_name": repo_name,
"year": current_year,
"request_url": "request.example.com",
"domain": "example.com"
})
20 changes: 8 additions & 12 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_name: !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost'] + '.github.io'
site_url: 'https://' + !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost'] + '.github.io'
site_name: "{{ username }}.github.io"
site_url: "https://{{ username }}.github.io"
theme:
name: material
logo: assets/images/plex-logo.webp
Expand Down Expand Up @@ -69,13 +69,9 @@ plugins:
- mkdocs-video
- git-revision-date-localized
- git-committers:
repository: !ENV [GITHUB_REPOSITORY, 'Ghost/repo']
repository: "{{ username }}/{{ repo_name }}"
branch: main
- macros:
variables:
username: !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost']
request_url: 'request.example.com'
domain: 'example.com'
- macros

markdown_extensions:
- toc:
Expand All @@ -97,19 +93,19 @@ markdown_extensions:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg

copyright: 'Copyright © ' + !ENV [CURRENT_YEAR, '2025'] + ' ' + !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost']
copyright: "Copyright © {{ year }} {{ username }}"

extra_css:
- stylesheets/extra.css

extra:
social:
- icon: fontawesome/brands/github
link: 'https://github.com/' + !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost']
name: !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost'] + ' @ Github'
link: "https://github.com/{{ username }}"
name: "{{ username }} @ Github"
- icon: fontawesome/brands/discord
link: https://discord.com
name: Discord Channel
- icon: fontawesome/solid/globe
link: 'https://' + !ENV [GITHUB_REPOSITORY_OWNER, 'Ghost'] + '.github.io'
link: "https://{{ username }}.github.io"
name: Personal Website

0 comments on commit 8a4d5e6

Please sign in to comment.