Public & Private

Learn how to create and manage pages that don't belong to specific modules using Core dna's Public and Private modules. This guide covers URL routing, template management, and implementation best practices.

Table of Contents

- Overview
- URL Structure
- Configuration
- Implementation Guide
- File Structure
- Best Practices

Overview

The Public and Private modules in Core dna provide a streamlined way to create standalone pages that: - Use block functions or slots - Don't belong to specific modules - Need minimal loading requirements - Require specific access controls

Key Features:

- Automatic user authentication checks for private pages

- SEO-friendly URL routing

- Automatic 404/homepage redirects on errors

- JSON response support for all requests

URL Structure

Example URLs

Public URLsDescription
https://sandbox10.coredna.com/public/contact-usBasic public page
https://sandbox10.coredna.com/public/about/about-usNested public page
https://sandbox10.coredna.com/private/abc123/mytestfileProtected private page

Configuration

URL Arguments

 https://sandbox10.coredna.com/?action=public&directory=about&form_name=about-us 

Required Parameters:

ParameterDescription
actionModule (public or private)
form_nameTemplate to use
directoryOptional. Directory path (single level only)

Implementation Guide

Important: It is recommended to use the Routing module to handle Public and Private requests.

URL Format Options

Both standard and pretty URL formats are supported:

 # Standard Format https://sandbox10.coredna.com/?action=public&directory=about&form_name=about-us # Pretty URL Format https://sandbox10.coredna.com/public/about/about-us 

File Structure

All templates must follow this structure:

/templates/[directory_name]/template.html

Best Practices

- Use the Routing module for handling requests
- Implement proper access controls for private pages
- Maintain consistent URL structure across the site
- Keep template files organized in appropriate directories
- Use JSON responses when building APIs

Common Issues

- 404 Errors: Verify template path and file existence

- Access Denied: Check user authentication for private pages

- Routing Issues: Confirm URL structure and parameters