Introduction
Manage website pages and mobile app screens with dynamic content.
🎯 What does this module do?
The Pages module lets you create, retrieve, and manage pages (for websites) or screens (for mobile apps) with all their content - text, images, SEO settings, and custom attributes.
Think of it as your content management system - instead of hardcoding pages, you manage them in OneEntry and fetch them dynamically in your app.
📖 Simple Explanation
Imagine you're building a website with these pages:
- 🏠 Home page - main landing page
- 📄 About Us - company information
- 📞 Contact - contact form page
- 📝 Blog posts - multiple article pages
- ❓ FAQ - help center
Instead of creating each page manually in your code, you:
- ✅ Create pages in OneEntry admin panel (with content, images, SEO)
- ✅ Fetch pages dynamically using this module
- ✅ Update content without redeploying your app
- ✅ Manage page structure, URLs, and metadata in one place
Real-world example:
Without Pages Module (hardcoded):
- Edit homepage → Change code → Test → Deploy → Wait ❌
- 10 pages = 10 code files to manage ❌
- SEO changes = code changes ❌
With Pages Module (dynamic):
- Edit homepage → Update in OneEntry admin → Live instantly ✅
- 100 pages = fetch dynamically from API ✅
- SEO changes = update in admin panel ✅
✨ Key Concepts
What is a Page?
A page is a content entity that represents:
- Web: A page on your website (e.g.,
/about,/contact) - Mobile: A screen in your app (e.g., Profile Screen, Settings Screen)
Each page contains:
- Content - Text, images, videos
- URL - Page address (e.g.,
/about-us) - SEO - Meta title, description, keywords
- Custom attributes - Any additional fields you define
- Status - Published, draft, archived
- Localization - Multi-language support
Page Types
OneEntry supports different page types:
| Type | Description | Example Use |
|---|---|---|
| Normal Page | Standard static page | About, Contact, Terms |
| Error Page | 404, 500 error pages | Not Found page |
| System Page | Special pages | Privacy Policy, Cookies |
| Template Page | Reusable page structure | Blog post template |
Page Hierarchy
Pages can be organized in a tree structure:
📁 Company
├─ About Us
├─ Team
└─ Careers
📁 Products
├─ Product Category 1
│ ├─ Product A
│ └─ Product B
└─ Product Category 2
Why this matters: You can fetch all pages in a section or build navigation menus automatically.
📋 What You Need to Know
1. Three Ways to Identify Pages
| Method | When to Use | Example |
|---|---|---|
| By URL | User visits specific page | /about-us, /contact |
| By ID | Internal references | 123, 456 |
Best practice: Use markers in code (they don't change), use URLs for routing.
2. Page Structure
Every page has these key fields:
{
id: 10,
parentId: null,
pageUrl: "catalog",
depth: 0,
localizeInfos: {
title: "Catalog",
menuTitle: "Catalog",
htmlContent: "",
plainContent: "",
},
isVisible: true,
blocks: ["product_block", "test"],
type: "catalog_page",
templateIdentifier: "template",
attributeSetIdentifier: "page",
attributeValues: {
text: {
type: "string",
value: "catalog text",
position: 0,
additionalFields: [],
},
number: {
type: "integer",
value: 0,
position: 1,
additionalFields: []
},
real: {
type: "real",
value: "",
position: 2,
additionalFields: []
},
float: {
type: "float",
value: 0,
position: 3,
additionalFields: []
},
},
moduleFormConfigs: [],
isSync: true,
template: {
id: 4,
attributeSetIdentifier: null,
title: "Template",
generalTypeId: 4,
identifier: "template",
version: 0,
generalTypeName: "catalog_page",
attributeValues: {},
position: 1,
},
}
3. Localization (Multi-language)
Pages support multiple languages
Same page, different languages!
4. Custom Attributes
You can add any fields to pages using AttributesSets:
Examples:
- Blog posts: author, publish date, tags, featured image
- Product pages: price, SKU, gallery, specifications
- Landing pages: hero image, CTA buttons, testimonials
Learn more: See AttributesSets Module
📊 Quick Reference Table - Common Methods
| Method | What It Does | When to Use |
|---|---|---|
| getPages() | Get all pages (paginated) | Build sitemap, list all pages |
| getRootPages() | Get all Root pages (paginated) | |
| getChildPagesByParentUrl() | Get all Child pages by ParentUrl (paginated) | |
| getPageById() | Get page by ID | Internal references |
| getPageByUrl() | Get page by URL | Routing (user visits /about) |
| getPageByMarker() | Get page by marker | Reference specific page in code |
| getQuickPages() | Get pages with minimal data | Fast navigation menus |
| getRelatedPages() | Get related/child pages | Build sub-menus, related articles |
❓ Common Questions (FAQ)
Q: What's the difference between URL and Marker?
A:
-
URL (
pageUrl) - The web address users see (e.g.,/about-us,/contact)- Can change over time
- Used for routing
- User-friendly
-
Marker - Technical identifier in code (e.g.,
homepage,contact_page)- Never changes
- Used in code references
- Technical, not user-facing
💡 Important Notes
Page URLs and Routing
Best practice for routing:
✅ Good: Dynamic catch-all route Next.js example: pages/[...slug].js
Caching for Performance
Reduce API calls with caching
Preview Drafts
Show draft pages to admins only
🎓 Best Practices
Do's:
- ✅ Use markers in code (not URLs - they can change)
- ✅ Cache pages to reduce API calls
- ✅ Handle 404 errors gracefully
- ✅ Filter by
statusId: 1andisVisible: truefor production - ✅ Use
getQuickPages()for navigation menus - ✅ Add loading states in UI
- ✅ Implement page caching strategy
Don'ts:
- ❌ Hardcode page URLs in your code
- ❌ Fetch all pages without pagination (performance!)
- ❌ Ignore
statusId- might show draft pages to users - ❌ Forget to handle language switching
- ❌ Load full pages when you only need basic info
- ❌ Skip error handling
More information about the module's user interface https://doc.oneentry.cloud/docs/category/pages
Definition of the Pages module
const { Pages } = defineOneEntry( "your-project-url", { "token": "your-app-token" });
🔗 Related Documentation
- Products Module - Manage e-commerce products
- Blocks Module - Reusable content blocks for pages
- AttributesSets Module - Custom fields for pages
- Menus Module - Navigation menu management