MCP HubMCP Hub
스킬 목록으로 돌아가기

build-pkgdown-site

pjt222
업데이트됨 2 days ago
1 조회
17
2
17
GitHub에서 보기
메타worddesign

정보

이 스킬은 R 패키지의 pkgdown 문서 사이트를 빌드하고 GitHub Pages에 배포합니다. 설정, 테마 적용, 문서 구성, 브랜치 기반 또는 GitHub Actions 워크플로우 같은 배포 방법을 다룹니다. 배포된 패키지 문서 사이트를 생성, 맞춤 설정 또는 수정할 때 활용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/build-pkgdown-site

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Build pkgdown Site

Configure and deploy a pkgdown documentation website for an R package.

When to Use

  • Creating a documentation site for an R package
  • Customizing pkgdown layout, theme, or navigation
  • Fixing 404 errors on a deployed pkgdown site
  • Migrating between deployment methods

Inputs

  • Required: R package with roxygen2 documentation
  • Required: GitHub repository
  • Optional: Custom theme or branding
  • Optional: Vignettes to include as articles

Procedure

Step 1: Initialize pkgdown

usethis::use_pkgdown()

This creates _pkgdown.yml and adds pkgdown to .Rbuildignore.

Got: _pkgdown.yml exists in the project root. .Rbuildignore contains pkgdown-related entries.

If fail: Install pkgdown with install.packages("pkgdown"). If _pkgdown.yml already exists, the function will update .Rbuildignore without overwriting the config.

Step 2: Configure _pkgdown.yml

url: https://username.github.io/packagename/

development:
  mode: release

template:
  bootstrap: 5
  bootswatch: flatly

navbar:
  structure:
    left: [intro, reference, articles, news]
    right: [search, github]
  components:
    github:
      icon: fa-github
      href: https://github.com/username/packagename

reference:
  - title: Core Functions
    desc: Primary package functionality
    contents:
      - main_function
      - helper_function
  - title: Utilities
    desc: Helper and utility functions
    contents:
      - starts_with("util_")

articles:
  - title: Getting Started
    contents:
      - getting-started
  - title: Advanced Usage
    contents:
      - advanced-features
      - customization

Critical: Set development: mode: release. The default mode: auto causes 404 errors on GitHub Pages because it appends /dev/ to URLs.

Got: _pkgdown.yml contains valid YAML with url, template, navbar, reference, and articles sections appropriate for the package.

If fail: Validate YAML syntax with an online YAML linter. Ensure all function names in reference.contents match actual exported functions.

Step 3: Build Locally

pkgdown::build_site()

Got: docs/ directory created with a complete site including index.html, function reference pages, and articles.

If fail: Common issues: missing pandoc (set RSTUDIO_PANDOC in .Renviron), missing vignette dependencies (install suggested packages), or broken examples (fix or wrap in \dontrun{}).

Step 4: Preview Site

pkgdown::preview_site()

Verify navigation, function reference, articles, and search work correctly.

Got: Site opens in the browser at localhost. All navigation links work, function reference pages render, and search returns results.

If fail: If the preview does not open, manually open docs/index.html in a browser. If pages are missing, check that devtools::document() was run before building the site.

Step 5: Deploy to GitHub Pages

Method A: GitHub Actions (Recommended)

See setup-github-actions-ci skill for the pkgdown workflow.

Method B: Manual Branch Deployment

# Build site
Rscript -e "pkgdown::build_site()"

# Create gh-pages branch if it doesn't exist
git checkout --orphan gh-pages
git rm -rf .
cp -r docs/* .
git add .
git commit -m "Deploy pkgdown site"
git push origin gh-pages

# Switch back to main
git checkout main

Got: The gh-pages branch exists on the remote with the site files at the root level.

If fail: If the push is rejected, ensure you have write access to the repository. If using GitHub Actions deployment instead, skip this step and follow the setup-github-actions-ci skill.

Step 6: Configure GitHub Pages

  1. Go to repository Settings > Pages
  2. Set Source to "Deploy from a branch"
  3. Select gh-pages branch, / (root) folder
  4. Save

Got: Site available at https://username.github.io/packagename/ within a few minutes.

If fail: If the site returns 404, verify the Pages source matches the deployment method (branch deployment requires "Deploy from a branch"). Check that development: mode: release is set in _pkgdown.yml.

Step 7: Add URL to DESCRIPTION

URL: https://username.github.io/packagename/, https://github.com/username/packagename

Got: DESCRIPTION URL field contains both the pkgdown site URL and the GitHub repository URL, separated by a comma.

If fail: If R CMD check warns about invalid URLs, verify the pkgdown site is deployed and accessible before adding the URL.

Validation

  • Site builds locally without errors
  • All function reference pages render correctly
  • Articles/vignettes are accessible and render properly
  • Search functionality works
  • Navigation links are correct
  • Site deploys successfully to GitHub Pages
  • No 404 errors on the deployed site
  • development: mode: release is set in _pkgdown.yml

Pitfalls

  • 404 errors after deployment: Almost always caused by development: mode: auto (the default). Change to mode: release.
  • Missing reference pages: Functions must be exported and documented. Run devtools::document() first.
  • Broken vignette links: Use vignette("name") syntax in cross-references, not file paths.
  • Logo not showing: Place logo at man/figures/logo.png and reference in _pkgdown.yml.
  • Search not working: Requires url field in _pkgdown.yml to be set correctly.
  • Wrong R binary on hybrid systems: On WSL or Docker, Rscript may resolve to a cross-platform wrapper instead of native R. Check with which Rscript && Rscript --version. Prefer the native R binary (e.g., /usr/local/bin/Rscript on Linux/WSL) for reliability. See Setting Up Your Environment for R path configuration.

Related Skills

  • setup-github-actions-ci - automated pkgdown deployment workflow
  • write-roxygen-docs - function documentation that appears on the site
  • write-vignette - articles that appear in the site navigation
  • release-package-version - trigger site rebuild on release

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-lite/skills/build-pkgdown-site
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

content-collections

메타

이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.

스킬 보기

polymarket

메타

이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.

스킬 보기

creating-opencode-plugins

메타

이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.

스킬 보기

sglang

메타

SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.

스킬 보기