jainilnagar/curtains
Composer 安装命令:
composer require jainilnagar/curtains
包简介
Maintenance mode, coming soon pages, and deployment windows for Craft CMS.
README 文档
README
Curtains for Craft CMS
Maintenance mode, coming-soon pages, and deployment windows for Craft CMS.
Curtains lets you draw a polished "curtain" over your site — a maintenance screen or a coming-soon launch page — while keeping admins, allow-listed IPs, and people holding a secret preview link working as normal. It ships with a custom control-panel section, CLI commands for your deploy scripts, a deploy banner, email signup capture, a countdown timer, and two designed layouts.
Features
Maintenance
- Enable/disable from the control panel or the command line
- Correct 503 Service Unavailable response (with
Retry-Afterwhen an end time is scheduled), or 200 if you prefer - Optional no-cache headers so the curtain is never cached by browsers or proxies
- Admin bypass — logged-in users with CP access keep browsing
- IP allowlist with CIDR range support (toggleable)
- Named secret preview links with an optional expiry (or never) — listable and revocable on demand
- Optional automatic start and end times for scheduled deployment windows
- Custom heading and message
Deployment
- CLI commands:
curtains/on,curtains/off,curtains/status— drop them straight into your deploy pipeline - Deploy banner shown to admins across the CP (e.g. "Maintenance mode enabled by John Doe 5 minutes ago"), toggleable
Launch / coming soon
- Countdown timer to a target date (its own field, falling back to the scheduled end)
- Email signup capturing name and email, stored in Craft and exportable to CSV, with honeypot + per-IP throttle to deter spam
- Configurable signup button text and success message
- Social and contact icons (Facebook, X, LinkedIn, YouTube, Pinterest, Instagram, WhatsApp, email, phone)
- Analytics (GA4 measurement ID or a custom snippet)
- SEO controls (title, description,
X-Robots-Tag/noindex)
Design
- Minimal layout — background image, logo, message, countdown, email form, social links
- Split screen layout — image on the left or right, content on the other side
- Configurable background colour, text colour, accent colour, background image, logo, and favicon
Extras
- Device preview mode (desktop / tablet / mobile) so you can check the curtain before raising it
- Dashboard "Curtains" widget (status, enabled at, scheduled off at, allowed IPs, subscribers)
- Granular permissions so you can scope access per user group
- Fully translatable (all strings run through the
curtainstranslation category)
Requirements
- Craft CMS 5.0.0 or later
- PHP 8.2 or later
Installation
You can install Curtains via the plugin store, or through Composer.
Composer
You can also add the package to your project using Composer and the command line.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to require the plugin, and Craft to install it:
composer require jainilnagar/curtains && php craft plugin/install curtains
Craft Plugin Store
To install Curtains, navigate to the Plugin Store section of your Craft control panel, search for Curtains.
Usage
Control panel
A Curtains section appears in the CP sidebar with four pages:
- Settings — a tabbed page covering everything: General (Curtain Mode on/off, optional automatic start and end times, 503/no-cache toggles, the admin banner toggle, and countdown/signup/social toggles), Content (heading, content, signup button text and success message, and the social/contact icons), Appearance (layout, colours, logo, background image, favicon), Access (admin bypass and IP allowlist), and SEO & Analytics.
- Preview — view the curtain in a desktop/tablet/mobile frame and switch between layouts before going live.
- Preview Links — create, copy, and revoke named secret preview links.
- Subscribers — browse, search, and export everyone who signed up, or remove entries (individually or in bulk).
Most options are stored in project config, so they deploy with your codebase. The Curtain Mode on/off toggle and its optional start/end schedule are stored separately in the database, so you can toggle maintenance in production even when allowAdminChanges is off — and the "enabled by / enabled at" metadata is recorded for the banner and widget.
Permissions
Curtains registers granular permissions so you can scope access per user group: manage settings; view and use the device preview; view, create, and delete preview links; and view, export, and delete subscribers. CP controls are hidden when a user lacks the matching permission, and every action is enforced server-side regardless.
Command line
# Raise the curtain (maintenance ON) ./craft curtains/on # Raise it and auto-lift after 30 minutes ./craft curtains/on --minutes=30 # Drop the curtain (site live again) ./craft curtains/off # Show current status, schedule and subscriber count ./craft curtains/status
A typical deploy script wraps the risky steps:
./craft curtains/on
# run migrations, clear caches, deploy assets…
./craft up
./craft curtains/off
Twig
The plugin exposes a craft.curtains variable:
{% if craft.curtains.isActive() %}
The curtain is currently up.
{% endif %}
{{ craft.curtains.subscriberCount() }} people are waiting.
{% set status = craft.curtains.getStatus() %}
{% if status.enabledAt %}Enabled at {{ status.enabledAt }}{% endif %}
Secret preview links
Open the Preview Links page (also linked from Settings → Access) to add a named link and pick either Never expire or an Expire at date and time. Each link is listed with a one-click copy button and its expiry, and can be removed — individually or in bulk — at any time.
Links are stored and validated against the database on every request, so removing one revokes it immediately — including for anyone who already has the bypass cookie. Opening a valid link sets a short-lived cookie so the holder can keep browsing during downtime.
Development
This plugin follows the Craft CMS coding standards and ships with static analysis configured.
# Check code style (craftcms/ecs) composer check-cs # Auto-fix code style composer fix-cs # Static analysis (craftcms/phpstan) composer phpstan
License
This plugin is licensed under the MIT License — see LICENSE.md.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-20