npm package: @rmdes/indiekit-endpoint-homepage
Description: Homepage builder endpoint for Indiekit. Configure layout, sections, and sidebar widgets from the admin UI.
Author: Ricardo Mendes
Latest version: 1.0.24

# @rmdes/indiekit-endpoint-homepage

Homepage builder endpoint for [Indiekit](https://getindiekit.com). Provides a visual admin UI for configuring your site's homepage layout, content sections, sidebar widgets, and footer columns.

## Features

- **Layout options** — Single-column, two-column, or full-width hero layouts
- **Drag-and-drop sections** — Arrange content sections from any registered plugin
- **Sidebar widgets** — Author card, search, categories, blogroll, social activity, and more
- **Footer columns** — Up to 3 configurable footer columns
- **Layout presets** — Quick-start presets for Blog, CV/Portfolio, or Hybrid layouts
- **Plugin discovery** — Automatically discovers sections/widgets from other Indiekit plugins

## Installation

```bash
npm install @rmdes/indiekit-endpoint-homepage
```

## Configuration

Add to your `indiekit.config.js`:

```javascript
import HomepageEndpoint from "@rmdes/indiekit-endpoint-homepage";

const homepage = new HomepageEndpoint({
  mountPath: "/homepage",
  contentDir: "/app/data/content"
});

export default {
  plugins: [homepage],
  // ... other config
};
```

## Usage

Once installed, navigate to `/homepage` in your Indiekit admin panel. The homepage builder lets you:

1. **Choose a layout** — Select single-column, two-column, or full-width hero
2. **Apply a preset** — Quick-start with Blog, CV/Portfolio, or Hybrid
3. **Add sections** — Drag content sections into the main area
4. **Configure sidebar** — Add widgets to the sidebar (two-column layout)
5. **Set up footer** — Add up to 3 footer columns

Changes are saved to MongoDB and written as a JSON file that triggers an Eleventy rebuild.

## Plugin Discovery

The homepage builder automatically discovers content sections and sidebar widgets from other installed Indiekit plugins. Any plugin that exports `homepageSections` or `homepageWidgets` will have its sections available in the builder.

### Registering Sections from Your Plugin

```javascript
class MyEndpoint {
  get homepageSections() {
    return [
      {
        id: "my-section",
        label: "My Section",
        description: "Displays my content",
        dataEndpoint: "/my-plugin/api/data.json"
      }
    ];
  }
}
```

## Built-in Content

### Sections
- **Hero** — Author intro with avatar, name, and bio
- **Recent Posts** — Latest posts from your site
- **Custom HTML** — Freeform content block

### Widgets
- **Author Card** — h-card with author info
- **Recent Posts** — Latest posts sidebar
- **Categories** — Tag cloud
- **Search** — Site search box
- **Social Activity** — Bluesky/Mastodon feeds
- **GitHub Repos** — Featured repositories
- **Funkwhale** — Listening activity
- **Blogroll** — Blog recommendations

## Integration

### With indiekit-eleventy-theme

The theme reads `homepage.json` (generated by this plugin) to render the configured homepage layout. No additional theme configuration is needed.

### With indiekit-endpoint-cv

The CV plugin registers 5 homepage sections: experience, skills, education, projects, and interests. Install both plugins to build a CV-style homepage.

### With other plugins

Any plugin that exports `homepageSections` or `homepageWidgets` is automatically discovered:
- `@rmdes/indiekit-endpoint-github` — GitHub activity
- `@rmdes/indiekit-endpoint-funkwhale` — Funkwhale listening
- `@rmdes/indiekit-endpoint-lastfm` — Last.fm scrobbles
- `@rmdes/indiekit-endpoint-blogroll` — Blogroll
- `@rmdes/indiekit-endpoint-podroll` — Podcast roll
- `@rmdes/indiekit-endpoint-youtube` — YouTube videos

## API Endpoints

| Endpoint | Auth | Description |
|----------|------|-------------|
| `GET /homepage/api/config.json` | Public | Current homepage configuration |
| `GET /homepage/api/sections` | Protected | List all available sections |
| `GET /homepage/api/widgets` | Protected | List all available widgets |

## License

MIT