Skip to content

add github metadata plugin#462

Open
stephmnt wants to merge 1 commit into
getnikola:masterfrom
stephmnt:add-github-metadata
Open

add github metadata plugin#462
stephmnt wants to merge 1 commit into
getnikola:masterfrom
stephmnt:add-github-metadata

Conversation

@stephmnt
Copy link
Copy Markdown

MermThis PR adds a GitHub metadata plugin for Nikola.

The plugin exposes a github namespace to Nikola templates, inspired by jekyll-github-metadata.

Features:

  • Public repository metadata retrieval from the GitHub API
  • Optional manual repository configuration
  • Template integration through injected metadata
  • Local caching support
  • Repository filtering and sorting options

Documentation, sample configuration and screenshot are included.

Tested with Nikola v8.

# ----------------------------

def _detect_repo_nwo(site) -> Optional[str]:
env = os.environ.get("GITHUB_REPOSITORY")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being read from environment variables?



# ----------------------------
# GitHub client (urllib, no requests)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can (perhaps even should) use requests, it’s a mandatory dependency of Nikola.

cache_dir = _cache_dir(site)

# Determine repo (optional) and user (for public repos)
detected_repo_nwo = _detect_repo_nwo(site)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does nwo stand for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants