### Initialize SvelteKit Project with Statue
Source: https://github.com/accretional/statue/blob/main/content/docs/templates.md
Demonstrates the full setup process for a new Statue site, starting with SvelteKit initialization, installing Statue, and then initializing with a specific template. It includes installing dependencies and starting the development server.
```bash
# Create SvelteKit project
npx sv create . --template minimal --types ts --no-add-ons --install npm
# Install Statue
npm install statue-ssg
# Initialize with chosen template
npx statue init --template blog
# Install dependencies and start
npm install
npm run dev
```
--------------------------------
### Example Startup/SaaS Site Configuration
Source: https://github.com/accretional/statue/blob/main/content/docs/site-config.md
Provides a complete example of a `siteConfig` object for a startup or SaaS application, including site information, contact details, and social media links. This serves as a template for initial setup.
```javascript
export const siteConfig = {
site: {
name: "YourApp",
description: "The best app for X",
url: "https://yourapp.com",
author: "YourApp Team"
},
contact: {
email: "hello@yourapp.com",
supportEmail: "support@yourapp.com"
},
social: {
twitter: "https://twitter.com/yourapp",
github: "https://github.com/yourorg"
}
};
```
--------------------------------
### Custom Route Example
Source: https://github.com/accretional/statue/blob/main/content/docs/routing.md
Shows standard SvelteKit routing for manually defined pages using '.svelte' files in the 'src/routes/' directory.
```svelte
src/routes/pricing/+page.svelte → /pricing
src/routes/contact/+page.svelte → /contact
```
--------------------------------
### Content Route to URL Mapping Example
Source: https://github.com/accretional/statue/blob/main/content/docs/routing.md
Demonstrates how the file structure within the 'content/' directory maps directly to URL paths for automatically generated pages.
```markdown
content/blog/my-post.md → /blog/my-post
content/docs/guide.md → /docs/guide
content/about.md → /about
```
--------------------------------
### Preview Local Site with npm
Source: https://github.com/accretional/statue/blob/main/AGENTS.md
This command starts a local development server to preview your static site. It's crucial for verifying that all pages load correctly, navigation functions as expected, images display properly, and there are no console errors before deployment.
```bash
npm run preview
```
--------------------------------
### Initialize Statue Site with npm
Source: https://github.com/accretional/statue/blob/main/README.md
This command initializes a new Statue static site project using npm. It leverages `npx sv create` to scaffold the project with a minimal template, TypeScript types, and no additional add-ons. The command then navigates into the project directory, installs the `statue-ssg` package, initializes the Statue project, installs dependencies, and starts the development server.
```bash
yes | npx sv create statue-site --template minimal --types ts --no-add-ons --install npm && cd statue-site && npm install statue-ssg && npx statue init && npm install && npm run dev
```
--------------------------------
### Configure Site and SEO Settings
Source: https://github.com/accretional/statue/blob/main/AGENTS.md
Example configuration for `site.config.js` showing essential site details like name, URL, author, and SEO parameters. These settings control site-wide information and metadata.
```javascript
site: {
name: "Your Site Name",
description: "Your site description",
url: "https://yoursite.com",
author: "Your Name"
},
seo: {
defaultTitle: "Your Site Title",
titleTemplate: "%s | Your Site",
defaultDescription: "Your site description",
keywords: ["keyword1", "keyword2"],
ogImage: "/assets/your-image.jpg",
twitterCard: "summary_large_image"
}
```
--------------------------------
### Start Development Server
Source: https://github.com/accretional/statue/blob/main/content/docs/themes.md
After making changes to your theme files or CSS, you can test them by starting the development server. Run the `npm run dev` command in your project's terminal. Visit your site in the browser to see the applied theme changes.
```bash
npm run dev
```
--------------------------------
### Statue: Initialize Project with Template
Source: https://github.com/accretional/statue/blob/main/content/docs/get-started.md
Initializes a new Statue project using a specified template. The default template is used if no argument is provided. This command sets up the initial project structure and necessary files.
```bash
npx statue init --template blog
npx statue init
```
--------------------------------
### Initialize Default Statue Template
Source: https://github.com/accretional/statue/blob/main/content/docs/templates.md
Initializes a new Statue project with the default template, providing a full-featured starting point for general-purpose, marketing, or documentation sites. This command copies the necessary route files, example content, and site configuration into your project.
```bash
npx statue init
```
--------------------------------
### Initialize Statue Site with pnpm
Source: https://github.com/accretional/statue/blob/main/README.md
This command initializes a new Statue static site project using pnpm. It employs `npx sv create` to generate the project with a minimal template, TypeScript, and no add-ons, setting pnpm as the package manager. Subsequently, it navigates into the project directory, adds `statue-ssg` via pnpm, initializes the Statue project, installs all dependencies using pnpm, and starts the development server with pnpm.
```bash
yes | npx sv create statue-site --template minimal --types ts --no-add-ons --install pnpm && cd statue-site && pnpm add statue-ssg && npx statue init && pnpm install && pnpm run dev
```
--------------------------------
### Example Markdown Content
Source: https://github.com/accretional/statue/blob/main/ADDING_TEMPLATES.md
This markdown file demonstrates how to structure example content for a blog post within a template. It includes frontmatter for metadata such as title, description, and date, followed by markdown content. This serves as a practical example for users of the template.
```markdown
---
title: Example Blog Post
description: This is an example post for your template
date: 2024-01-01
---
# Welcome to Your Template
This is example content that shows users how the template works.
Add more example content to demonstrate features.
```
--------------------------------
### Initialize Statue Site with Yarn
Source: https://github.com/accretional/statue/blob/main/README.md
This command initializes a new Statue static site project using Yarn. It utilizes `npx sv create` to scaffold the project with a minimal template, TypeScript, and no add-ons, specifying Yarn as the package manager. The process then changes the directory, adds `statue-ssg` using Yarn, initializes the Statue project, installs all necessary dependencies with Yarn, and starts the development server using Yarn.
```bash
yes | npx sv create statue-site --template minimal --types ts --no-add-ons --install yarn && cd statue-site && yarn add statue-ssg && npx statue init && yarn install && yarn run dev
```
--------------------------------
### Example Content Structure (File Tree)
Source: https://github.com/accretional/statue/blob/main/content/docs/new-site-checklist.md
Illustrates a typical directory structure for organizing content within a Statue project. It shows examples of markdown files for blog posts, documentation, and projects, located under the `content/` directory.
```filetree
content/
├── blog/my-first-post.md
├── docs/guide.md
└── projects/project-one.md
```
--------------------------------
### Initialize Statue Project
Source: https://context7.com/accretional/statue/llms.txt
Initializes a new Statue project using the command-line interface. It can set up a project with default or specific templates and can be combined with other commands for a complete setup.
```bash
npx statue init
npx statue init --template blog
# Complete one-line setup (npm)
yes | npx sv create my-site --template minimal --types ts --no-add-ons --install npm \
&& cd my-site \
&& npm install statue-ssg \
&& npx statue init \
&& npm install \
&& npm run dev
```
--------------------------------
### Statue: Site Configuration Example
Source: https://github.com/accretional/statue/blob/main/content/docs/get-started.md
Defines site-wide settings for a Statue project. This JavaScript object includes information such as the site's name, URL, contact email, and social media handles.
```javascript
export const siteConfig = {
site: { name: "Your Site", url: "https://yoursite.com" },
contact: { email: "hello@yoursite.com" },
social: { twitter: "https://twitter.com/yourhandle" }
};
```
--------------------------------
### Provide Meaningful Example Content for Statue Templates
Source: https://github.com/accretional/statue/blob/main/ADDING_TEMPLATES.md
Contrasts good and bad examples of content for Statue templates, emphasizing the importance of providing realistic and informative example content. Good content helps users understand how to use the template effectively.
```markdown
# Getting Started with Web Development
Learn the fundamentals of building modern websites...
# Test Post
Lorem ipsum dolor sit amet...
```
--------------------------------
### Testing Package Build Script
Source: https://github.com/accretional/statue/blob/main/CONTRIBUTING.md
The command to execute the release testing script, which automates the process of packing the library, creating a new SvelteKit project, installing the package, and verifying the build.
```bash
# Build and test the package
./scripts/test-release.sh
```
--------------------------------
### Implement Responsive Design with CSS Grid in Statue Templates
Source: https://github.com/accretional/statue/blob/main/ADDING_TEMPLATES.md
Shows an example of creating a responsive layout using CSS Grid classes in a Svelte component for Statue templates. The example demonstrates how to adjust the number of columns based on screen size (mobile, tablet, desktop).
```svelte
```
--------------------------------
### Common npm Development Scripts
Source: https://github.com/accretional/statue/blob/main/CONTRIBUTING.md
A collection of frequently used npm scripts for development, including starting the dev server, building for production, previewing the build, and packaging the project.
```bash
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Package for npm (creates .tgz file)
npm pack
# Run release tests
./scripts/test-release.sh
```
--------------------------------
### Run Release Test Script (Bash)
Source: https://github.com/accretional/statue/blob/main/DEVELOPMENT.md
Executes a shell script to perform release testing. This script packs the library, sets up a temporary environment, creates SvelteKit apps, and installs Statue to verify build integrity.
```bash
./scripts/test-release.sh
```
--------------------------------
### JavaScript Code Style Examples
Source: https://github.com/accretional/statue/blob/main/CONTRIBUTING.md
Illustrates recommended JavaScript coding practices, including descriptive variable names, preference for 'const', use of arrow functions for callbacks, and JSDoc comments for functions.
```javascript
// Use descriptive variable names
const contentEntries = scanContentDirectory();
// Prefer const over let
const directories = getContentDirectories();
// Use arrow functions for callbacks
items.map(item => item.title);
// Add JSDoc comments for exported functions
/**
* Processes template variables in markdown content
* @param {string} content - The markdown content
* @returns {string} - Processed content with variables replaced
*/
export function processTemplateVariables(content) {
// ...
}
```
--------------------------------
### Statue Blog Post Structure Example (JavaScript)
Source: https://github.com/accretional/statue/blob/main/content/blog/drag-drop-publish.md
Illustrates a JavaScript code snippet for logging a message to the console, as would be written within a Statue blog post's Markdown content. This example highlights the use of backticks for inline code and triple backticks for code blocks.
```javascript
console.log("Hello, blog readers!");
```
--------------------------------
### List Available Templates (Bash)
Source: https://github.com/accretional/statue/blob/main/DEVELOPMENT.md
Lists all available templates for the Statue SSG. This command helps users identify which templates can be loaded for development.
```bash
npm run template:list
```
--------------------------------
### Setting Environment Variables for Development
Source: https://github.com/accretional/statue/blob/main/content/docs/site-config.md
Provides an example of how to set the `VITE_SITEURL` environment variable when running a development server using npm. This allows for environment-specific configuration during the development phase.
```bash
VITE_SITEURL=https://staging.yoursite.com npm run dev
```
--------------------------------
### SubDirectories Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Shows the usage of the SubDirectories component, which displays a grid of subdirectory cards. It accepts an array of subdirectory objects, each with a title and URL.
```svelte
```
--------------------------------
### DirectoryHeader Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Demonstrates the DirectoryHeader component, used for the header of directory listing pages. It requires a 'title' prop to display the name of the directory.
```svelte
```
--------------------------------
### Footer Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Illustrates the implementation of the Footer component, which includes a sitemap and social links. It is configurable with directory data, current path, copyright text, legal links, and social links.
```svelte
```
--------------------------------
### Build Project Locally
Source: https://github.com/accretional/statue/blob/main/VALIDATION_GUIDE.md
Command to compile and build the project for deployment. This step is essential for testing the final output and ensuring all components function correctly.
```bash
# Run build
npm run build
```
--------------------------------
### URL Structure from Content Folder
Source: https://github.com/accretional/statue/blob/main/content/docs/routing.md
Illustrates how the nested folder structure within the 'content/' directory directly translates into the URL paths for content pages.
```markdown
content/blog/hello.md → /blog/hello
content/docs/guides/intro.md → /docs/guides/intro
content/projects/2024/project.md → /projects/2024/project
```
--------------------------------
### NavigationBar Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Shows the implementation of the NavigationBar component, which displays top navigation with a logo, links, and a mobile menu. It accepts an array of navigation items and the current active path for highlighting.
```svelte
```
--------------------------------
### Add Component to User Documentation
Source: https://github.com/accretional/statue/blob/main/ADDING_COMPONENTS.md
Illustrates how to add a new component's documentation to the user-facing documentation file (`content/docs/components.md`). It includes a brief description and a simple Svelte code example for usage.
```markdown
### YourComponent
Description.
```svelte
```
**Props:**
- `title` (string, required) - The title
```
--------------------------------
### Importing Custom Svelte Components
Source: https://github.com/accretional/statue/blob/main/AGENTS.md
Shows how to import custom Svelte components from the `src/lib/components/` directory into your Svelte pages or layouts using the `$lib` alias.
```svelte
import ComponentName from '$lib/components/ComponentName.svelte';
```
--------------------------------
### LatestContent Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Shows the usage of the LatestContent component for displaying recent content items as cards. It accepts an array of content objects, each with a URL and metadata including title, description, and date.
```svelte
```
--------------------------------
### Hero Component Example (Svelte)
Source: https://github.com/accretional/statue/blob/main/content/docs/components.md
Illustrates the basic usage of the Hero component, which is intended for landing page hero sections. This component has no configurable props and its content is built-in, requiring a fork for customization.
```svelte
```
--------------------------------
### Statue: Markdown Content Example
Source: https://github.com/accretional/statue/blob/main/content/docs/get-started.md
Illustrates the structure of a Markdown content file used by Statue. It includes frontmatter for metadata (like title) and standard Markdown for the page body.
```markdown
---
title: My Blog Post
---
# Hello World
This is my first post!
```
--------------------------------
### Build and Preview Static Site
Source: https://context7.com/accretional/statue/llms.txt
Provides command-line instructions for building the static site using `npm run build`, previewing the production build locally with `npm run preview`, and notes that build artifacts are placed in the `build/` directory. It also mentions automatic generation of sitemap and search index.
```bash
# Build the site
npm run build
# Build artifacts are in the build/ directory
# The postbuild script automatically:
# 1. Generates sitemap.xml and robots.txt
# 2. Runs Pagefind to create search index
# Preview production build locally
npm run preview
# Deploy to various platforms:
# - Netlify: Deploy build/ directory
# - Vercel: Deploy build/ directory
# - Cloudflare Pages: Deploy build/ directory
# - GitHub Pages: Deploy build/ directory
```
--------------------------------
### Initialize Blog Template for Statue
Source: https://github.com/accretional/statue/blob/main/content/docs/templates.md
Initializes a new Statue project specifically with the blog template, offering a streamlined structure focused on content creation. This is ideal for personal blogs or content-heavy websites. The command applies a minimal homepage and a dedicated blog directory with example posts.
```bash
npx statue init --template blog
```
--------------------------------
### Restore Default Template (Git)
Source: https://github.com/accretional/statue/blob/main/DEVELOPMENT.md
Restores the default template by checking out the relevant files from Git. This is necessary after working on a custom template to revert to the default setup.
```git
git checkout src/routes content site.config.js
```
--------------------------------
### Statue: Theme Styling Import
Source: https://github.com/accretional/statue/blob/main/content/docs/get-started.md
Imports a CSS theme file for styling the Statue website. This line in `src/lib/index.css` determines the overall look and feel of the site. Multiple themes are available.
```css
@import "statue-ssg/themes/blue.css";
```
--------------------------------
### Initialize Statue Site with Bun
Source: https://github.com/accretional/statue/blob/main/README.md
This command initializes a new Statue static site project using Bun. It uses `npx sv create` for project scaffolding with a minimal template, TypeScript, and no add-ons, specifying Bun as the package manager. After creation, it changes the directory, adds `statue-ssg` using Bun, initializes the Statue project, installs dependencies with Bun, and runs the development server with Bun.
```bash
yes | npx sv create statue-site --template minimal --types ts --no-add-ons --install bun && cd statue-site && bun add statue-ssg && npx statue init && bun install && bun run dev
```
--------------------------------
### Build and Preview Locally (Bash)
Source: https://github.com/accretional/statue/blob/main/content/docs/new-site-checklist.md
Commands to build the Statue project for production and then preview the built site locally. This is crucial for testing the website's appearance, functionality, and links before deployment.
```bash
npm run build
npm run preview
```
--------------------------------
### Statue: Svelte Component Usage
Source: https://github.com/accretional/statue/blob/main/content/docs/get-started.md
Demonstrates how to incorporate pre-built or custom Svelte components within a Statue page. Components like Hero, Stats, and Categories help construct dynamic page layouts.
```svelte
```
--------------------------------
### Export Component in src/lib/index.ts (TypeScript)
Source: https://github.com/accretional/statue/blob/main/VALIDATION_GUIDE.md
This code shows how to correctly export a Svelte component from the `src/lib/index.ts` file. It includes an example of adding a new component export while maintaining alphabetical order with existing exports.
```typescript
export { default as YourComponent } from './components/YourComponent.svelte';
```
```typescript
// Export all components
export { default as Hero } from './components/Hero.svelte';
export { default as Stats } from './components/Stats.svelte';
export { default as YourComponent } from './components/YourComponent.svelte'; // Add yours here
```
--------------------------------
### Example Custom Svelte Component Structure
Source: https://github.com/accretional/statue/blob/main/AGENTS.md
Demonstrates a flexible Svelte component structure with exportable props for customization, CSS custom properties for theming, slot usage, and inline SVG for graphics. Follows Svelte 4 syntax.
```svelte
{#if showIcon}
{/if}
```
--------------------------------
### Deploy to Cloudflare Pages (Bash)
Source: https://github.com/accretional/statue/blob/main/content/docs/new-site-checklist.md
Command to build the Statue project and deploy the generated static files to Cloudflare Pages. Requires the Wrangler CLI and specifies the project name for deployment.
```bash
npm run build
npx wrangler pages deploy build --project-name=your-project
```
--------------------------------
### Document Component in COMPONENTS_README.md (Markdown)
Source: https://github.com/accretional/statue/blob/main/VALIDATION_GUIDE.md
This markdown snippet provides a template for documenting a Svelte component in the `COMPONENTS_README.md` file. It includes sections for a brief description, an import and usage example, and a detailed list of props with their types and required status.
```markdown
### YourComponent
Brief description of what this component does.
```svelte
```
**Props:**
- `title` (string, required) - The title text
- `description` (string, optional) - Optional description text
```
--------------------------------
### Create Fully Custom Homepage (Svelte)
Source: https://github.com/accretional/statue/blob/main/AGENTS.md
Provides an example of a fully custom homepage (`src/routes/+page.svelte`) without using any default `statue-ssg` components. This approach is suitable for unique designs like portfolios or landing pages and includes custom navigation and styling within the component.
```svelte
{siteConfig.seo.defaultTitle}