Major improvements to shop URL routing and vendor landing page system:
## Landing Page System
- Add template field to ContentPage model for flexible landing page designs
- Create 4 landing page templates: default, minimal, modern, and full
- Implement smart root handler to serve landing pages or redirect to shop
- Add create_landing_page.py script for easy landing page management
- Support both domain/subdomain and path-based vendor access
- Add comprehensive landing page documentation
## Route Fixes
- Fix duplicate /shop prefix in shop_pages.py routes
- Correct product detail page routing (was /shop/shop/products/{id})
- Update all shop routes to work with router prefix mounting
- Remove unused public vendor endpoints (/api/v1/public/vendors)
## Template Link Corrections
- Fix all shop template links to include /shop/ prefix
- Update breadcrumb 'Home' links to point to vendor root (landing page)
- Update header navigation 'Home' link to point to vendor root
- Correct CMS page links in footer navigation
- Fix account, cart, and error page navigation links
## Navigation Architecture
- Establish two-tier navigation: landing page (/) and shop (/shop/)
- Document complete navigation flow and URL hierarchy
- Support for vendors with or without landing pages (auto-redirect fallback)
- Consistent breadcrumb and header navigation behavior
## Documentation
- Add vendor-landing-pages.md feature documentation
- Add navigation-flow.md with complete URL hierarchy
- Update shop architecture docs with error handling section
- Add orphaned docs to mkdocs.yml navigation
- Document multi-access routing patterns
## Database
- Migration f68d8da5315a: add template field to content_pages table
- Support template values: default, minimal, modern, full
This establishes a complete landing page system allowing vendors to have
custom marketing homepages separate from their e-commerce shop, with
flexible template options and proper navigation hierarchy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
9.6 KiB
9.6 KiB
Shop Navigation Flow
Complete guide to navigation structure and URL hierarchy with landing pages.
URL Hierarchy
/ (Vendor Root) → Landing Page (if exists) OR redirect to /shop/
├── /shop/ → E-commerce Homepage (Product Catalog)
│ ├── /shop/products → Product Catalog (same as /shop/)
│ ├── /shop/products/{id} → Product Detail Page
│ ├── /shop/cart → Shopping Cart
│ ├── /shop/checkout → Checkout Process
│ ├── /shop/account/login → Customer Login
│ ├── /shop/account/register → Customer Registration
│ ├── /shop/account/dashboard → Customer Dashboard (auth required)
│ ├── /shop/about → CMS Content Page
│ ├── /shop/contact → CMS Content Page
│ └── /shop/{slug} → Other CMS Pages
Navigation Patterns
Pattern 1: With Landing Page (Recommended)
URL Structure:
customdomain.com/ → Landing Page (marketing/brand)
customdomain.com/shop/ → E-commerce Shop
customdomain.com/shop/products → Product Catalog
Navigation Flow:
- User visits vendor domain → Landing Page
- Clicks "Shop Now" → /shop/ (product catalog)
- Clicks "Home" in breadcrumb → / (back to landing page)
- Clicks logo → / (back to landing page)
Breadcrumb Example (on Products page):
Home > Products
↓
/ (Landing Page)
Pattern 2: Without Landing Page (Auto-Redirect)
URL Structure:
customdomain.com/ → Redirects to /shop/
customdomain.com/shop/ → E-commerce Shop
customdomain.com/shop/products → Product Catalog
Navigation Flow:
- User visits vendor domain → Redirects to /shop/
- User browses shop
- Clicks "Home" in breadcrumb → / (redirects to /shop/)
- Clicks logo → / (redirects to /shop/)
Breadcrumb Example (on Products page):
Home > Products
↓
/ → /shop/ (redirects)
Link References
Base URL Calculation
The base_url variable is calculated in shop_pages.py:get_shop_context():
# For domain/subdomain access
base_url = "/"
# Result: /shop/products, /shop/cart, etc.
# For path-based access
base_url = "/vendors/wizamart/"
# Result: /vendors/wizamart/shop/products, /vendors/wizamart/shop/cart, etc.
Template Links
Logo / Home Link (Header):
{# Points to vendor root (landing page or shop) #}
<a href="{{ base_url }}shop/">{{ vendor.name }}</a>
Breadcrumb Home Link:
{# Points to vendor root (landing page) #}
<a href="{{ base_url }}">Home</a>
Shop Links:
{# All shop pages include /shop/ prefix #}
<a href="{{ base_url }}shop/products">Products</a>
<a href="{{ base_url }}shop/cart">Cart</a>
<a href="{{ base_url }}shop/checkout">Checkout</a>
CMS Page Links:
{# CMS pages are under /shop/ #}
<a href="{{ base_url }}shop/about">About</a>
<a href="{{ base_url }}shop/contact">Contact</a>
<a href="{{ base_url }}shop/{{ page.slug }}">{{ page.title }}</a>
Complete URL Examples
Path-Based Access (Development)
http://localhost:8000/vendors/wizamart/
├── / (root) → Landing Page OR redirect to shop
├── /shop/ → Shop Homepage
├── /shop/products → Product Catalog
├── /shop/products/4 → Product Detail
├── /shop/cart → Shopping Cart
├── /shop/checkout → Checkout
├── /shop/account/login → Customer Login
├── /shop/about → About Page (CMS)
└── /shop/contact → Contact Page (CMS)
Subdomain Access (Production)
https://wizamart.platform.com/
├── / (root) → Landing Page OR redirect to shop
├── /shop/ → Shop Homepage
├── /shop/products → Product Catalog
├── /shop/products/4 → Product Detail
├── /shop/cart → Shopping Cart
├── /shop/checkout → Checkout
├── /shop/account/login → Customer Login
├── /shop/about → About Page (CMS)
└── /shop/contact → Contact Page (CMS)
Custom Domain Access (Production)
https://customdomain.com/
├── / (root) → Landing Page OR redirect to shop
├── /shop/ → Shop Homepage
├── /shop/products → Product Catalog
├── /shop/products/4 → Product Detail
├── /shop/cart → Shopping Cart
├── /shop/checkout → Checkout
├── /shop/account/login → Customer Login
├── /shop/about → About Page (CMS)
└── /shop/contact → Contact Page (CMS)
User Journeys
Journey 1: First-Time Visitor (With Landing Page)
- Visit
customdomain.com/→ Landing Page- Sees brand story, features, CTA
- Clicks "Shop Now" →
/shop/→ Product Catalog- Browses products
- Clicks product →
/shop/products/4→ Product Detail- Views product
- Clicks "Home" in breadcrumb →
/→ Back to Landing Page - Clicks logo →
/→ Back to Landing Page
Journey 2: Returning Customer (Direct to Shop)
- Visit
customdomain.com/shop/→ Product Catalog- Already knows the brand, goes straight to shop
- Adds to cart →
/shop/cart→ Shopping Cart - Checkout →
/shop/checkout→ Checkout - Clicks "Home" →
/→ Landing Page (brand homepage)
Journey 3: Customer Account Management
- Visit
customdomain.com/shop/account/login→ Login - After login →
/shop/account/dashboard→ Dashboard - View orders →
/shop/account/orders→ Order History - Clicks logo →
/→ Back to Landing Page
Navigation Components
Header Navigation (base.html)
{# Logo - always points to vendor root #}
<a href="{{ base_url }}shop/">
<img src="{{ theme.branding.logo }}" alt="{{ vendor.name }}">
</a>
{# Main Navigation #}
<nav>
<a href="{{ base_url }}shop/">Home</a>
<a href="{{ base_url }}shop/products">Products</a>
<a href="{{ base_url }}shop/about">About</a>
<a href="{{ base_url }}shop/contact">Contact</a>
</nav>
{# Actions #}
<a href="{{ base_url }}shop/cart">Cart</a>
<a href="{{ base_url }}shop/account">Account</a>
Footer Navigation (base.html)
{# Quick Links #}
<a href="{{ base_url }}shop/products">Products</a>
{# CMS Pages (dynamic) #}
{% for page in footer_pages %}
<a href="{{ base_url }}shop/{{ page.slug }}">{{ page.title }}</a>
{% endfor %}
Breadcrumbs (products.html, content-page.html)
{# Points to vendor root (landing page) #}
<a href="{{ base_url }}">Home</a> / Products
Best Practices
✅ DO:
- Use Landing Pages: Create engaging landing pages at vendor root
- Clear Navigation: Make it easy to get from landing to shop and back
- Consistent "Home": Logo and "Home" breadcrumb both point to
/(landing) - Shop Links: All shop-related links include
/shop/prefix - CMS Under Shop: Keep CMS pages under
/shop/for consistency
❌ DON'T:
- Hardcode URLs: Always use
{{ base_url }}for vendor-aware links - Skip /shop/: Don't link directly to
/products, use/shop/products - Mix Landing & Shop: Keep landing page separate from shop catalog
- Forget Breadcrumbs: Always provide "Home" link to go back
Migration Notes
Before Landing Pages
All links pointed to /shop/:
<a href="{{ base_url }}shop/">Home</a> {# Logo #}
<a href="{{ base_url }}shop/">Home</a> {# Breadcrumb #}
After Landing Pages
Separation of concerns:
<a href="{{ base_url }}shop/">Home</a> {# Logo - still goes to shop #}
<a href="{{ base_url }}">Home</a> {# Breadcrumb - goes to landing #}
This allows:
- Landing page at
/for marketing/branding - Shop catalog at
/shop/for e-commerce - Clean navigation between the two
Technical Implementation
Route Handlers (main.py)
# Vendor root - serves landing page or redirects to shop
@app.get("/")
@app.get("/vendors/{vendor_code}/")
async def root(request: Request):
if has_landing_page():
return render_landing_page()
else:
return redirect_to_shop()
# Shop routes
@app.include_router(shop_pages.router, prefix="/shop")
@app.include_router(shop_pages.router, prefix="/vendors/{vendor_code}/shop")
Context Calculation (shop_pages.py)
def get_shop_context(request: Request):
base_url = "/"
if access_method == "path":
base_url = f"/vendors/{vendor.subdomain}/"
return {
"base_url": base_url,
"vendor": vendor,
"theme": theme,
# ...
}
Summary
The navigation system creates a two-tier structure:
- Landing Page (
/) - Marketing, branding, vendor story - Shop (
/shop/) - E-commerce, products, cart, checkout
This gives vendors flexibility to:
- Have a marketing homepage separate from their store
- Choose different landing page designs (minimal, modern, full)
- Or skip the landing page and go straight to the shop
All while maintaining clean, consistent navigation throughout the experience.