Skip to content

Conversation

@whyisjake
Copy link

Overview

This PR adds a complete, production-ready documentation site for the VIP Block Data API plugin built with Docusaurus (React-based).

What's Included

📚 Complete Documentation

  • Getting Started: Installation, setup, and first API request
  • API Reference: Full REST and GraphQL API documentation
  • WordPress Hooks: All filters and actions with practical examples
  • Guides: Block filtering, custom attributes, bindings, synced patterns
  • Examples: REST, GraphQL, React renderer, and filtering examples
  • Advanced Topics: Performance, caching, attribute sources, troubleshooting

🎨 Design & Features

  • WordPress VIP design system and color scheme (matching docs.wpvip.com)
  • Responsive layout with dark mode support
  • Mobile-friendly navigation
  • Search-ready (Algolia DocSearch integration)
  • Clean, modern UI with code syntax highlighting

💻 Technical Implementation

  • Built with Docusaurus 3.x
  • 20+ documentation pages with extensive code examples
  • Complete React block renderer component
  • TypeScript type definitions
  • Examples for React, Next.js, Apollo Client, and more
  • PHP, JavaScript, GraphQL, and bash code examples

🚀 Deployment

  • GitHub Actions workflow for automatic deployment to GitHub Pages
  • Triggers on pushes to trunk branch
  • Static site generation for optimal performance

How to Use

Local Development

cd docs
npm install
npm start

Build for Production

cd docs
npm run build

Enable GitHub Pages

  1. Go to repository Settings → Pages
  2. Select "GitHub Actions" as the source
  3. Merge this PR to deploy automatically

Documentation Site Structure

docs/
├── intro.md                    # Overview and introduction
├── getting-started.md          # Installation and setup
├── api/                        # API reference
│   ├── rest-api.md
│   ├── graphql-api.md
│   └── response-format.md
├── hooks/                      # WordPress hooks
│   ├── filters.md
│   └── actions.md
├── guides/                     # How-to guides
│   ├── block-filtering.md
│   ├── custom-attributes.md
│   ├── block-bindings.md
│   └── synced-patterns.md
├── examples/                   # Code examples
│   ├── rest-api-examples.md
│   ├── graphql-examples.md
│   ├── react-renderer.md
│   └── filtering-blocks.md
└── advanced/                   # Advanced topics
    ├── block-attribute-sources.md
    ├── performance.md
    ├── caching.md
    └── troubleshooting.md

Preview

Once merged and deployed, the documentation will be available at:
https://automattic.github.io/vip-block-data-api/

Testing Checklist

  • All documentation pages created and organized
  • Code examples tested and verified
  • WordPress VIP design style applied
  • Mobile responsive layout
  • Dark mode support
  • Navigation structure complete
  • GitHub Actions deployment workflow configured
  • Local build succeeds
  • All internal links work correctly

Benefits

  1. Better Developer Experience: Comprehensive, searchable documentation
  2. Reduced Support Load: Self-service guides and troubleshooting
  3. Professional Presentation: Modern, well-designed documentation site
  4. Easy Maintenance: Markdown-based, version-controlled docs
  5. Community Growth: Lower barrier to entry for new users

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

This commit adds a complete Docusaurus-based documentation site for the VIP Block Data API plugin with the following features:

## Documentation Structure
- Introduction and getting started guide
- Complete REST API reference with code examples
- Full GraphQL API documentation
- WordPress hooks reference (filters and actions)
- How-to guides for common use cases
- Advanced topics (performance, caching, troubleshooting)
- Extensive code examples for React, Next.js, and more

## Technical Implementation
- Built with Docusaurus 3.x (React-based)
- WordPress VIP design system and color scheme
- Responsive layout with dark mode support
- Comprehensive code examples in PHP, JavaScript, TypeScript, GraphQL
- TypeScript type definitions for block structures
- Complete React block renderer implementation

## Key Features
- Automatic GitHub Pages deployment via GitHub Actions
- Search-ready (Algolia DocSearch integration)
- Mobile-responsive design
- Extensive real-world examples
- Best practices for WordPress and React

## Documentation Coverage
- REST API endpoints and parameters
- GraphQL queries with Apollo Client
- All WordPress filters and actions
- Block filtering techniques
- Custom attribute examples
- Performance optimization strategies
- Caching implementations
- Common troubleshooting scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@whyisjake whyisjake requested a review from a team as a code owner November 14, 2025 02:36
whyisjake and others added 2 commits November 13, 2025 18:51
Extends the documentation with detailed examples for enabling draft access:

## New Content
- Complete "Draft & Preview Access Guide" covering:
  - Basic authenticated draft access
  - Author-only draft viewing
  - Headless WordPress preview modes
  - Time-limited preview tokens
  - Next.js preview mode integration
  - Scheduled posts access
  - Private posts handling

## Enhanced Filter Documentation
Added 7 new examples to vip_block_data_api__rest_validate_post_id:
- Allow authenticated users to view drafts
- Allow post authors to view their own drafts
- Allow editors to preview with specific capabilities
- Allow draft access with time-limited preview tokens
- Role-based draft access
- Content preview for headless CMS
- Scheduled posts (future) access

## Security Best Practices
- Token validation with constant-time comparison
- Permission checking examples
- Rate limiting implementation
- Input sanitization
- Time-limited token generation

This addresses common use cases for headless WordPress applications
that need to preview draft content before publishing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Significantly enhances the vip_block_data_api__rest_permission_callback
documentation with comprehensive authentication examples and best practices.

## New Examples Added
1. **Require Publish Capability** - Using current_user_can('publish_posts')
2. **Application Password Authentication** - WordPress 5.6+ app passwords
3. **API Key Authentication** - Custom API key validation
4. **JWT Token Authentication** - Integration with JWT plugins
5. **Combine Multiple Conditions** - OR logic for auth + IP whitelist
6. **Rate Limiting for Public Access** - Throttle public requests
7. **Time-Based Access Control** - Business hours example

## Additional Content
- Client-side usage examples for Application Passwords
- Client-side usage examples for API Key authentication
- Important caching warning callout for authenticated requests
- Practical code examples for headless WordPress applications

## Key Features Covered
- Application Passwords (WordPress 5.6+)
- Custom API key validation
- JWT token authentication
- IP whitelisting
- Combined authentication methods
- Rate limiting strategies
- Time-based access control
- Caching implications on WordPress VIP

These examples provide production-ready code for securing the Block Data API
in various scenarios from simple authentication to complex multi-condition access.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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