Skip to main contentSkip to footer

Documentation

Comprehensive guides and references for the Webocreation project. Everything you need to know about setting up, customizing, and extending this Next.js project.

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (version 18.0.0 or later)
  • npm (version 9.0.0 or later) or yarn
  • Git

Installation

Follow these steps to get the project up and running on your local machine:

  1. Clone the repository:

    git clone https://github.com/yourusername/webocreation-nextjs.git
  2. Navigate to the project directory:

    cd webocreation-nextjs
  3. Install dependencies:

    npm install

    or if you're using yarn:

    yarn install
  4. Create a .env.local file:

    cp .env.example .env.local

    Then edit .env.local to add your environment variables.

  5. Start the development server:

    npm run dev

    or if you're using yarn:

    yarn dev

The application should now be running at http://localhost:3000.

Project Structure

This project follows the Next.js 13+ App Router structure. Here's an overview of the main directories:

webocreation-nextjs/
├── public/            # Static assets
├── src/
│   ├── app/           # App Router pages and layouts
│   │   ├── about/     # About page
│   │   ├── ads-services/ # Ads Services page
│   │   ├── brand-identity-design/ # Brand Identity Design page
│   │   ├── careers/   # Careers page
│   │   ├── contact/   # Contact page
│   │   ├── docs/      # Documentation page
│   │   ├── social-media-promotion/ # Social Media Promotion page
│   │   ├── layout.tsx # Root layout
│   │   └── page.tsx   # Home page
│   ├── components/    # Reusable components
│   │   ├── ProcessSteps.tsx # Process steps component
│   │   └── ... other components
│   ├── utils/         # Utility functions
│   └── styles/        # Global styles
├── .env.example       # Example environment variables
├── .env.local         # Local environment variables (create this)
├── next.config.js     # Next.js configuration
├── package.json       # Dependencies and scripts
├── postcss.config.js  # PostCSS configuration
├── tailwind.config.js # Tailwind CSS configuration
└── tsconfig.json      # TypeScript configuration

Components

The project includes several reusable components. Here are the key ones:

ProcessSteps

A versatile component for displaying process steps in various formats (timeline, cards, vertical).

// Example usage
import ProcessSteps from '@/components/ProcessSteps';

<ProcessSteps 
  title="Our Process"
  subtitle="A systematic approach to success"
  variant="timeline" // Options: "timeline", "cards", "vertical"
  accentColor="orange" // Primary color for the component
  steps={[
    {
      title: "Step 1: Discovery",
      description: "Detailed description of the first step."
    },
    {
      title: "Step 2: Strategy",
      description: "Detailed description of the second step."
    },
    // Add more steps as needed
  ]}
/>

CalendlyWidget

A component for embedding Calendly scheduling into your pages.

// Example usage in contact-form.tsx
// The component uses the NEXT_PUBLIC_CALENDLY_URL environment variable
// Make sure to set this in your .env.local file

// If the Calendly URL is defined, the widget will be displayed
// If not, the section will be hidden

Component List

A comprehensive list of all available components in the project. Each component includes a description, props, and usage examples.

HeroSection

HeroSection component

A flexible hero section component that supports two layout modes: split layout with image and slanted edge, or full-width gradient background.

Props

  • title: Main heading text
  • description: Descriptive text
  • imageSrc: Optional image URL
  • titleBreak: Whether to break title into two lines
  • gradientFrom/gradientTo: Gradient color classes
View Documentation →

ProcessSteps

ProcessSteps component

A versatile component for displaying process steps in various formats: timeline, cards, or vertical.

Props

  • title: Section title
  • subtitle: Descriptive subtitle
  • steps: Array of step objects
  • variant: Layout style (default, cards, timeline, vertical)
  • accentColor: Primary color theme
View Documentation →

BlogSection

BlogSection component

Displays a grid of blog posts with featured images, titles, excerpts, and metadata.

Props

  • title: Section title
  • subtitle: Descriptive subtitle
  • posts: Array of post objects
  • layout: Grid layout style
  • showViewAllLink: Whether to show "View All" link
View Documentation →

CommentSection

CommentSection component

Displays and manages comments for blog posts, with support for nested replies and form validation.

Props

  • postId: WordPress post ID
  • comments: Array of comment objects
  • onCommentSubmit: Callback function
  • allowReplies: Whether to allow nested replies
View Documentation →

FaqSection

FaqSection component

Displays a list of frequently asked questions with expandable answers using accordion functionality.

Props

  • title: Section title
  • subtitle: Descriptive subtitle
  • faqs: Array of FAQ objects
  • layout: Layout style (default, columns, grid)
View Documentation →

TrustedCompanies

TrustedCompanies component

Displays a logo carousel of trusted companies or clients with optional animation.

Props

  • title: Section title
  • companies: Array of company objects with logos
  • animated: Whether to animate the logos
  • grayscale: Whether to display logos in grayscale
View Documentation →

Layout Components

Navbar

Responsive navigation bar with dropdown menus and mobile menu.

Footer

Site footer with multiple columns, links, and newsletter signup.

CTA

Call-to-action section with customizable background and buttons.

ClientLayout

Layout wrapper for client-specific pages with sidebar.

LayoutWrapper

General wrapper for page content with consistent spacing.

NavigationWrapper

Wrapper for navigation components with consistent styling.

UI Components

Accordion

Expandable content panels for presenting information in a limited space.

Alert

Contextual feedback messages for user actions and notifications.

Button

Customizable button component with various styles and sizes.

Form

Form components with validation and responsive layout.

Modal

Dialog overlay for focused user interactions and confirmations.

Tabs

Tabbed interface for organizing content into separate views.

Note: The component screenshots are placeholders. To add actual screenshots, create an /images/docs/ directory in the public folder and add images for each component.

Elements

Individual UI elements and blocks that can be used throughout the project:

Accordions

Collapsible content panels for presenting information in a limited space.

View Documentation →

Breadcrumbs

Navigation aid that helps users keep track of their location within the website.

View Documentation →

Buttons

Interactive elements in various styles, sizes, and states for user actions.

View Documentation →

Clients

Display client logos and testimonials in an organized and visually appealing way.

View Documentation →

Carousel

Slideshow component for cycling through elements like images or slides of text.

View Documentation →

Call to Action

Attention-grabbing sections designed to prompt an immediate response from users.

View Documentation →

Testimonials

Display customer reviews and feedback in various layouts and styles.

View Documentation →

Typography

Text styling options including headings, paragraphs, lists, and special text treatments.

View Documentation →

Team

Display team members with their photos, roles, and social media links.

View Documentation →

Tab

Organize content into separate views where only one view is visible at a time.

View Documentation →

Videos

Embed and display videos from various sources with customizable controls.

View Documentation →

Form

Input components and form layouts with validation and submission handling.

View Documentation →

Accordion Component

Use accordions to organize content into collapsible sections, making information easier to digest.

// Example usage
import Accordion from '@/components/elements/Accordion';

<Accordion 
  items={[
    {
      title: 'Section 1',
      content: 'Content for section 1 goes here.'
    },
    {
      title: 'Section 2',
      content: 'Content for section 2 goes here.'
    }
  ]}
  allowMultiple={false} // Set to true to allow multiple sections open at once
  defaultOpen={0} // Index of the section that should be open by default
/>

Pages

The project includes several pre-built pages:

  • Home Page - The main landing page at /
  • About Page - Company information at /about
  • Ads Services - Advertising services at /ads-services
  • Brand Identity Design - Branding services at /brand-identity-design
  • Social Media Promotion - Social media services at /social-media-promotion
  • Careers - Job listings at /careers
  • Contact - Contact form with Calendly integration at /contact
  • Documentation - This documentation page at /docs

Each page is built using the App Router structure and includes metadata for SEO.

Styling

This project uses Tailwind CSS for styling. The main configuration is in tailwind.config.js.

Color Scheme

The primary color scheme uses orange as the accent color. You can customize this in the Tailwind configuration.

Responsive Design

All components and pages are designed to be fully responsive, using Tailwind's responsive utilities.

Brand Guide Changes

Replace Webocreation

Replace "Webocreation" with "Your Name" of your brand guide.

Replace bg-orange-600 and bg-orange-50 to your color

Replace "bg-orange-600" and "bg-orange-50" with "Your Color" of your brand guide.

Web Accessibility Compliance

1. Semantic HTML

  • Use proper heading hierarchy (h1-h6) in descending order
  • Use semantic elements (nav, main, section, article, aside, footer)
  • Use appropriate form labels and fieldset/legend for grouped form controls
  • Implement ARIA landmarks and roles when native HTML isn't sufficient

2. Keyboard Navigation

  • Ensure all interactive elements are keyboard accessible (tabindex="0")
  • Implement visible focus states for all interactive elements
  • Create logical tab order that follows the visual flow
  • Provide skip navigation links for bypassing repeated content

3. Color & Contrast

  • Maintain minimum contrast ratio of 4.5:1 for normal text
  • Ensure color is not the only means of conveying information
  • Provide sufficient contrast for interactive elements
  • Test with color blindness simulators

4. Images & Media

  • Provide meaningful alt text for informative images
  • Use empty alt (alt="") for decorative images
  • Provide captions and transcripts for audio and video content
  • Ensure video players have keyboard controls

5. Forms & Interactive Elements

  • Associate labels with form controls using for and id
  • Provide clear error messages and validation feedback
  • Use appropriate input types (email, tel, url, etc.)
  • Ensure custom controls are keyboard accessible

6. Responsive Design

  • Ensure content is readable and functional at all viewport sizes
  • Use relative units (em, rem, %) instead of fixed units (px)
  • Test with different screen sizes and zoom levels
  • Ensure touch targets are at least 44x44 pixels

7. Testing & Validation

  • Use automated tools like Axe, WAVE, or Lighthouse
  • Test with screen readers (NVDA, VoiceOver, JAWS)
  • Perform keyboard-only navigation testing
  • Conduct manual testing with users who have disabilities

8. Performance Considerations

  • Optimize images and media for fast loading
  • Minimize and bundle JavaScript/CSS
  • Implement lazy loading for below-the-fold content
  • Consider the impact of third-party scripts

9. WCAG 2.1 Compliance

Our goal is to meet WCAG 2.1 Level AA standards, which includes:

  • Perceivable: Information and user interface components must be presentable to users in ways they can perceive
  • Operable: User interface components and navigation must be operable
  • Understandable: Information and the operation of user interface must be understandable
  • Robust: Content must be robust enough to be interpreted reliably by a wide variety of user agents, including assistive technologies

10. Resources

Environment Variables

The project uses environment variables for configuration. Create a .env.local file in the root directory with the following variables:

# Calendly integration
NEXT_PUBLIC_CALENDLY_URL=your_calendly_url_here

# Add other environment variables as needed

Deployment

This Next.js project can be deployed to various platforms. Here are instructions for the most common ones:

Vercel (Recommended)

Vercel is the easiest way to deploy your Next.js app:

  1. Sign up for a Vercel account at vercel.com
  2. Install the Vercel CLI: npm i -g vercel
  3. Run vercel from the project root
  4. Follow the prompts to deploy your project

Netlify

To deploy on Netlify:

  1. Sign up for a Netlify account at netlify.com
  2. Click "New site from Git"
  3. Connect to your repository
  4. Set the build command to npm run build
  5. Set the publish directory to .next
  6. Add your environment variables in the Netlify dashboard

Troubleshooting

Here are solutions to common issues you might encounter:

Module not found errors

If you see errors about missing modules, ensure you've installed all dependencies:

npm install

Calendly widget not showing

If the Calendly widget isn't displaying on the contact page, check that you've set the NEXT_PUBLIC_CALENDLY_URL environment variable in your .env.local file.

Build errors

If you encounter build errors, try clearing the Next.js cache:

rm -rf .next

Then rebuild the project:

npm run build

Need More Help?

If you have questions or need assistance with this project, feel free to:

API Reference

YouTube Data API

Setup Instructions

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the "YouTube Data API v3"
  4. Go to "Credentials" and create a new API key
  5. Add the key to your .env.local file:
    NEXT_PUBLIC_YOUTUBE_API_KEY=your_youtube_api_key_here

WordPress REST API

Setup

Add to .env.local:

NEXT_PUBLIC_WORDPRESS_URL=https://your-wordpress-site.com WP_API_USERNAME=your_username WP_API_PASSWORD=your_application_password

Mailchimp API

Setup

Add to .env.local:

MAILCHIMP_API_KEY=your_mailchimp_api_key MAILCHIMP_SERVER_PREFIX=your_server_prefix (e.g., us2) MAILCHIMP_LIST_ID=your_audience_id

Email Configuration

Add to .env.local:

EMAIL_USER=your_email@example.com EMAIL_PASSWORD=your_email_password_or_app_password

WordPress

Sitemap Generation

The project includes automatic sitemap.xml generation that pulls content from WordPress. Here's how it works:

Sitemap Structure

The sitemap includes the following content types:

  • Static pages (homepage, about, contact, blog)
  • WordPress pages
  • WordPress posts
  • Categories
  • Tags
  • Author pages

Implementation

The sitemap is generated using the WordPress REST API. The code is located in src/lib/sitemap.ts:

// Main sitemap generation function
export async function generateSitemap(): Promise<string> {
  const [
    pages,
    posts,
    categories,
    tags,
    authors
  ] = await Promise.all([
    getPages(),
    getPosts(),
    getCategories(),
    getTags(),
    getAuthors()
  ]);

  const allUrls = [
    // Static pages
    { url: process.env.NEXT_PUBLIC_WORDPRESS_URL, changefreq: 'daily', priority: 1.0, lastmod: new Date().toISOString() },
    { url: process.env.NEXT_PUBLIC_WORDPRESS_URL + '/about', changefreq: 'monthly', priority: 0.8, lastmod: new Date().toISOString() },
    { url: process.env.NEXT_PUBLIC_WORDPRESS_URL + '/contact', changefreq: 'monthly', priority: 0.8, lastmod: new Date().toISOString() },
    { url: process.env.NEXT_PUBLIC_WORDPRESS_URL + '/blog', changefreq: 'daily', priority: 0.9, lastmod: new Date().toISOString() },
    // Dynamic content
    ...pages,
    ...posts,
    ...categories,
    ...tags,
    ...authors
  ];

  // Generate XML
  const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  ${allUrls.map(entry => `
  <url>
    <loc>${entry.url}</loc>
    ${entry.lastmod ? `<lastmod>${new Date(entry.lastmod).toISOString()}</lastmod>` : ''}
    ${entry.changefreq ? `<changefreq>${entry.changefreq}</changefreq>` : ''}
    ${entry.priority ? `<priority>${entry.priority}</priority>` : ''}
  </url>`).join('')}
</urlset>`;

  return sitemap;
}

Data Fetching

The sitemap generator fetches data from WordPress using pagination to handle large datasets:

// Example: Fetching posts for the sitemap
export async function getPosts(): Promise<SitemapEntry[]> {
  try {
    let allPosts: Array<{ slug: string; modified: string }> = [];
    let page = 1;
    let hasMore = true;

    while (hasMore) {
      const response = await fetch(
        `${process.env.NEXT_PUBLIC_WORDPRESS_URL}/wp-json/wp/v2/posts?per_page=100&page=${page}&_fields=slug,modified`
      );
      
      if (!response.ok) throw new Error('Failed to fetch posts');
      
      const posts = await response.json();
      allPosts = [...allPosts, ...posts];
      
      // Check if there are more pages
      const totalPages = parseInt(response.headers.get('X-WP-TotalPages') || '1');
      hasMore = page < totalPages;
      page++;
    }
    
    return allPosts.map((post: { slug: string; modified: string }) => ({
      url: `${process.env.NEXT_PUBLIC_WORDPRESS_URL}/${post.slug}`,
      lastmod: post.modified,
      changefreq: 'weekly',
      priority: 0.7
    }));
  } catch (error) {
    console.error('Error fetching posts:', error);
    return [];
  }
}

Integration with Next.js

To serve the sitemap, create a route handler at app/sitemap.xml/route.ts:

import { generateSitemap } from '@/lib/sitemap';
import { NextResponse } from 'next/server';

export async function GET() {
  const sitemap = await generateSitemap();
  
  return new NextResponse(sitemap, {
    headers: {
      'Content-Type': 'application/xml',
      'Cache-Control': 'public, max-age=3600, s-maxage=3600'
    }
  });
}

Theme Customizations (functions.php)

Add the following code to your WordPress theme's functions.php file:

Allow Anonymous Comments via REST API

function filter_rest_allow_anonymous_comments() {
    return true;
}
add_filter('rest_allow_anonymous_comments','filter_rest_allow_anonymous_comments');

Add Custom Fields to REST API

function add_custom_fields_to_rest_api() {
    register_rest_field( 'post', 'td_post_video', array(
        'get_callback' => 'get_my_custom_field',
        'update_callback' => null,
        'schema' => null,
    ) );
}
add_action( 'rest_api_init', 'add_custom_fields_to_rest_api' );

function get_my_custom_field( $object, $field_name, $request ) {
    return get_post_meta( $object['id'], $field_name, true );
}

Insert Ads Above H2 Tags

add_filter('the_content', 'insert_ads_above_h2');

Note: You'll need to implement the insert_ads_above_h2 function to define what content gets inserted above H2 tags.

WordPress Comments

Posting a Comment

async function postComment(postId: number, commentData: {
  author_name: string;
  author_email: string;
  content: string;
}) {
  const response = await fetch(
    `https://webocreation.com/index.php/wp-json/wp/v2/comments`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Basic ' + Buffer.from(
          `rupaknpl:!UQTb^mRM&(vJa*G0FU(4hj2`
        ).toString('base64')
      },
      body: JSON.stringify({
        post: postId,
        ...commentData,
      }),
    }
  );
  return await response.json();
}
Innovation

Let's Make Something Amazing Together

We always provide our best creative ideas at the highest level. Tell us about your project and we will make it work.

InnovateBringing innovative solutions to complex problems
AutomateStreamlining processes through automation
DominateLeading the market with exceptional results
Build Smarter and Launch FasterEfficient development for rapid deployment