EditlyCMS
A lightweight, flat-file CMS for editing HTML templates directly in the browser, with a built-in blog, folder-aware dashboard, sitemaps and social share images. No database setup required: just drop it next to your HTML files and start editing.
Introduction
EditlyCMS is a flat-file content management system that lets you edit HTML pages directly in the browser. Unlike WordPress or other database-driven CMS platforms, EditlyCMS works directly with your existing HTML files — there is no database to configure, no hosting requirements beyond PHP, and no migration needed.
It works by scanning your website for HTML files that contain specially marked elements (cms-content), then letting you click and edit those elements through a floating toolbar injected into the page.
How it works
When you open a page in edit mode, EditlyCMS:
- Reads the page (or its saved draft) from disk. PHP code is set aside and never sent to the browser
- Injects a floating toolbar at the bottom of the page
- Makes all
cms-contentelements directly editable (they show a dashed blue outline) - When you save, stores your changes in a private draft in
cms/data/drafts/, not next to the live page - When you publish, a backup of the current page is made, then the draft replaces the live file. Backups are not limited in number; you delete them yourself in the dashboard
What EditlyCMS is good for
- Static HTML sites that need occasional content updates
- Client handoff — give clients a way to edit text and images without touching code
- Landing pages, portfolio sites, restaurant menus, property listings
- Any site where the developer builds the HTML and the client maintains the content
What it is not
- Not a page builder — it cannot change layout or add new sections
- Not a multi-user system — single account only
- Not suitable for highly dynamic sites (e-commerce, user accounts, etc.)
Want to see it first? Open the live demo to try Editly CMS on a real site.
What's new in 1.3.0
Version 1.3.0 adds the things a growing site asks for: pages organised by folder, copies of pages, a blog, and the basics of search and social sharing. Templates built for earlier versions need no changes.
- Folders as tiles. The dashboard shows each folder of your site as a tile in the same grid as pages. Open a folder to see its pages; use the breadcrumb to go back. All pages shows everything at once, and search always looks across every folder.
- Duplicate and rename pages. The new ⋯ menu on each card duplicates a page (title and file name of your choice) or renames it. Titles,
og:title, canonical links andog:urlare kept in step. - A blog system. A post template, a blog list page that fills itself, and a New post button. New posts stay hidden until their first publish. Blog posts can also be deleted from the dashboard. See Writing Blog Posts and Blog Setup.
- sitemap.xml. One click generates a sitemap for your site, or one per site if folders have their own addresses.
- Social share images. The CMS draws a 1200×630 image (title, description, site name) for any page and adds the
og:imagetags. It needs the PHP GD extension with FreeType. - Replace image. Hover an image in the editor and press Replace to swap it for another, instead of deleting it and inserting a new one.
- A cleaner address. The dashboard and login now live at
/cms/admin/. Anyone opening/cms/or/cms/index.phpis sent there automatically, so bookmarks keep working. - New settings tabs. Settings now has Blog (the markup you need, and a button to rebuild lists) and SEO (sites, colours, sitemap, social images).
Updating an existing site
Replace everything inside cms/ except cms/data/ and cms/uploads/, then open /cms/admin/. Nothing else is needed: your account, pages, drafts and backups carry over, and the database gets no new tables. Templates built for earlier versions need no changes.
- New files:
cms/admin/,cms/api/Blog.php,cms/api/Seo.phpand the font files incms/api/fonts/(the Inter font, SIL Open Font License). - Generated social images are saved in
cms/uploads/og/.
Installation
EditlyCMS runs on any web server with a current version of PHP and the PDO SQLite extension enabled. It works on shared hosting (InfinityFree, cPanel, etc.), VPS servers, and locally via WAMP, XAMPP, Laragon, or similar.
Requirements
| Requirement | Details |
|---|---|
| PHP | A current, supported PHP version (8.1 or newer is a good choice), with the PDO SQLite extension. Almost every host has both. |
| Extensions | PDO SQLite, DOM, JSON, Session (all enabled by default on almost every host). mbstring is not needed. |
| Optional: GD with FreeType | Only for social share images. Most hosts have it. On XAMPP it is switched off by default: open php\php.ini, remove the ; in front of extension=gd, and restart Apache. Everything else works without it. |
| Writable folders | cms/data/ and cms/uploads/, plus the pages you publish. The site's main folder must also be writable if you want sitemap.xml written there. |
| Your HTML files | Must be in the same folder as cms/ or in subfolders |
Setup steps
Upload the cms/ folder
Place the cms/ folder in the root of your website — the same folder that contains your HTML files.
Set folder permissions
Make sure the cms/ folder is writable by the web server. On Linux/cPanel 755 is usually enough (use 775 if your host runs PHP under a different user). Avoid 777. On shared hosting this is usually done via your FTP client or File Manager.
Visit /cms/admin/ in your browser
Navigate to https://yoursite.com/cms/admin/. The CMS initializes itself on first run: it creates the private data/ folder and the SQLite database automatically.
Create your account
Choose a username and a password of at least 10 characters. This screen appears only once.
Create your account right after uploading. Whoever opens /cms/admin/ first sets up the account, so do not leave a fresh install sitting online unconfigured.
Folder structure after installation
Optional: the blog starter
The download also contains a blog/ folder with a ready-made, minimal blog: a front page, a post template, three sample posts and their images. Upload it next to cms/ to try the blog straight away, or use it as a base for your own design. See Blog Setup.
First Login
Navigate to /cms/admin/ on your site. The first time, you will see Create your account.
| Field | Rule |
|---|---|
| Username | 3 to 32 characters: letters, numbers, _ . - |
| Password | 10 to 72 characters, and not something obvious like admin |
There is no default login. You choose the username and password yourself, so nobody can get in with a well-known account.
After that you will land on the Dashboard, which shows all editable pages found on your site. From then on /cms/admin/ shows the normal login screen.
Dashboard user
The dashboard is your home base. It automatically scans your website and shows every HTML or PHP file that contains editable regions, as a grid of cards. Folders appear in the same grid as tiles.
Page cards
Each card shows:
- A live preview, a small picture of the page itself. Click it to edit. Previews show the published page without running scripts, so sliders and animations stay still.
- Page title, taken from the HTML
<title>tag. If every title ends with the same site name (for exampleAbout | My Site), that shared ending is hidden so the grid stays readable. Hover the title to see the full text. - File name (or the full path when you are viewing all pages at once).
- Edit status: when the page was last edited ("Edited 2 days ago"), with a dot: amber for unpublished changes, green for published, grey for a page that has not been edited yet.
- A Draft tag over the preview when unpublished changes exist. The preview itself still shows the live version.
- Blog badges: Blog post template, Blog list, Blog post (with its date) and Unpublished post.
In each folder the home page (index.html) comes first, then the other pages alphabetically, and blog posts last, newest first.
Folders
As soon as your editable pages are in more than one folder, the dashboard shows each folder as a tile next to the pages: a preview of the folder's home page, its name, how many pages are inside (including sub-folders), a Blog badge if it holds a blog, and a draft count when something is unpublished. Click a tile to open it. A breadcrumb (Main folder / hostel / rooms) takes you back up. See Folders, Duplicate, Rename.
Search
Once your site has more than four pages, a search box appears. Type part of a title or file name: the grid switches to one flat list of every matching page from all folders. Clear the box to return to the folder you were in.
View switch
By folder (default) shows folder tiles. All pages lists every page of the site in one grid, with its full path. The choice is remembered in your browser.
Page actions
| Button | What it does |
|---|---|
| Edit | Opens the page in edit mode with the floating toolbar. Clicking the preview does the same. |
| New post | Only on a blog post template: creates a new blog post from it and opens the editor. |
| View | Opens the published version of the page in a new tab |
| Backups (3) | Shows a list of previous versions you can restore. It appears once the page has at least one backup. |
| ⋯ → Duplicate… | Makes a copy of the page in the same folder |
| ⋯ → Rename… | Changes the title and/or file name |
| ⋯ → Social image… | Draws or redraws the page's share image |
| ⋯ → Delete post… | Only on blog posts: deletes the post for good |
Settings panel
Click Settings in the top-right header to open the settings panel. It has four tabs:
- Password: change your login password
- Username: change your login username (requires current password)
- Blog: the markup a blog needs, and Update blog lists now
- SEO: your site addresses, social image colours, sitemap and image generation
Light and dark mode
The login screen, dashboard and editor follow your device's light or dark setting. There is no switch to flip: change the setting on your computer or phone and the CMS follows.
Folders, Duplicate, Rename user
How folders are found
Nothing needs to be configured. EditlyCMS already scans your whole site for pages with editable regions; the dashboard simply groups them by the folder each file is in. A site whose pages are spread over /, /hostel/ and /hostel/rooms/ shows two tiles (hostel and, inside it, rooms) next to the main folder's own pages. Hidden folders, cms/, vendor/ and node_modules/ are skipped.
Duplicate a page
- Open the ⋯ menu on the card and choose Duplicate…
- Enter a title. The file name is suggested from it (letters, numbers and hyphens); change it if you like
- Click Create copy
The copy is made in the same folder as the original, so relative links to CSS, scripts and images keep working. It is created from the published version of the page (not from a draft). The page title is replaced; a | Site name ending is kept. If the page has og:title, twitter:title, a canonical link or og:url, they are updated to match, and EditlyCMS tells you if one could not be changed safely. A social image generated for the original is not copied.
Rename a page
⋯ → Rename… changes the title and/or the file name. Drafts, backups and the dashboard entry follow the page, and blog lists are rebuilt. A folder's index page keeps its file name (you can still change its title).
Links from other pages to the old file name are not updated. After renaming, check the menus and links that pointed to the page.
Delete a blog post
Blog posts have ⋯ → Delete post…. After you confirm, the post's file, its draft, its backups and its generated social image are deleted permanently, and it disappears from the blog list and the sitemap. This cannot be undone.
Only blog posts can be deleted from the dashboard. Other pages are never deleted by EditlyCMS; remove those through FTP or your host's file manager.
Writing Blog Posts user
This page is for the person who writes posts. It assumes the developer has set up the blog (see Blog Setup, or upload the blog/ starter folder).
Write a new post
- In the dashboard, open the folder that holds the blog
- On the Blog post template card, click New post
- Enter the title and, if you wish, a date. Click Create post
- The editor opens on the new post. Write the summary and text, replace the cover image (hover it and press Replace), then Save and Publish
A new post is not shown in the blog list, and is not in the sitemap, until you publish it for the first time. Until then it is listed in the dashboard as Unpublished post. (Anyone who knows its address can still open the file, so do not put secrets in it.)
What appears in the blog list
The list shows each published post's cover image, date, title and summary, newest first. They come from the post itself: change the title, date, summary or cover image in the post, publish, and the list updates by itself. The date is read from the text you type (for example 5 March 2026), so keep it in a form like that.
Edit, rename, delete
- Edit a post like any page: Edit, Save, Publish. Each publish makes a backup you can restore.
- ⋯ → Rename… changes the title (also in the post's title area) and the address. Links to the old address will break.
- ⋯ → Delete post… removes the post for good.
- ⋯ → Duplicate… on a post makes a copy of it; to start a fresh post use New post on the template instead.
If the list looks out of date
Open Settings → Blog and press Update blog lists now. This rebuilds every blog list on the site.
Sitemap & Social Images user
Open Settings → SEO.
Your site
Enter the public address of your site (for example https://example.com) and its name. If you leave the address empty, EditlyCMS uses the address you are visiting right now, which is right for most sites. The name is printed on social images.
Separate sites in folders
If one of your folders is served on its own address (for example /hostel/ shown as hostel.example.com), add it under Separate sites in folders: choose the folder, enter its address and name. That folder then gets its own sitemap.xml with its own addresses, and its own name on social images. Folders you do not add belong to the main site.
sitemap.xml
Generate sitemap.xml saves your settings and writes sitemap.xml into the main folder (and into each separate site's folder). It lists:
- every
.html/.htmpage, and every.phppage that has editable regions indexpages under the address of their folder (https://example.com/hostel/)- the date each file was last changed
Left out automatically: pages with noindex in their robots meta tag, files whose name starts with _, error pages (404, 403, 500…), blog post templates and unpublished blog posts. Add your own exclusions in Sitemap exceptions, one pattern per line, for example private/*.
A sitemap.xml that EditlyCMS did not create is never overwritten. Rename or delete it first if you want EditlyCMS to manage it. Afterwards, add the line Sitemap: https://example.com/sitemap.xml to your robots.txt and submit the address in Google Search Console; EditlyCMS does not edit robots.txt.
Social (Open Graph) images
When a page is shared on social networks or in chat apps, the og:image tag decides which picture appears. EditlyCMS can draw one for you.
- One page: ⋯ → Social image… on a card, then Generate. You see a preview.
- Every page: Generate social images for all pages in Settings → SEO.
The image is a 1200×630 PNG with the page title, a short description, your site name and address, in the colours you choose under Social image colours. It is saved in cms/uploads/og/ and these tags are added to the page's <head>: og:image, og:image:width, og:image:height, twitter:card and twitter:image. A backup of the page is made first. Regenerate after changing a title or the colours. Social networks cache images, so a shared link can take a while to show the new one.
Requires the PHP GD extension with FreeType. If it is missing, the SEO tab says so and everything else still works. On XAMPP, open php\php.ini, remove the ; in front of extension=gd and restart Apache.
Keep things up to date automatically
When ticked (and saved), EditlyCMS rebuilds the sitemap whenever a page is published, created, renamed, restored or a post is deleted, and redraws the social image of every blog post and of every page that already has a generated one. It is off until you save the SEO settings with the box ticked. A failure here never blocks publishing.
Editing Content user
Click Edit on any page card, or click its preview, to open the page in edit mode. The page loads normally in the browser with a floating toolbar at the bottom of the screen. You can move it to the top.
Identifying editable regions
Editable areas have a dashed blue outline. Hover over one and the outline turns solid, and a small label shows its ID. Click inside to start typing.
Only elements marked by the developer as editable will show an outline. You cannot accidentally edit navigation, footers, or other structural elements unless the developer has marked them.
The toolbar
The toolbar is a single compact row. Everyday tools sit on the bar, less frequent ones are in the More menu, and rarely used actions are in the ⋯ menu. On a narrow screen the bar wraps onto a second row so nothing runs off the edge.
The More menu
Click More to open a small menu above (or below) the toolbar. It closes when you pick something, click elsewhere or press Esc.
| Item | Action | Shortcut |
|---|---|---|
| Strikethrough | Strike through the selected text | — |
| Indent / Outdent | Indent or outdent a list item or paragraph | — |
| Align left / centre / right | Align the current paragraph | — |
| Undo / Redo | Step back or forward through your edits | Ctrl+Z / Y |
| Embed video | Embed a YouTube or Vimeo video | — |
| Embed map | Embed a Google Map | — |
| Upload file | Upload a file and insert a download link | — |
The ⋯ menu
The ⋯ menu starts with the name of the file you are editing, followed by two actions:
- Move toolbar to top / bottom — switch where the toolbar sits. The CMS remembers your choice in this browser.
- Discard draft — delete the draft and return to the live version. You are asked to confirm.
Inserting a link
- Select the text you want to turn into a link
- Click the Link button
- Enter the URL and optionally choose to open in a new window
- Click Insert link
If you don't select text first, you can type the link text in the "Link text" field inside the dialog. The link will be inserted at your cursor position.
Embedding a video
- Click inside the editable region where you want the video
- Open More and choose Embed video
- Paste a YouTube or Vimeo URL (not an embed URL — just the regular page URL)
- Set width and height as needed
- Click Embed video
Embedding a Google Map
- In Google Maps, open the location you want
- Click Share → Embed a map and copy the
src="..."URL from the iframe code - In EditlyCMS, open More, choose Embed map and paste that URL
- Set width and height, then click Embed map
Pasting content
EditlyCMS strips all formatting when you paste — only plain text is inserted. This prevents messy styles from being copied in from Word, Google Docs, or other websites. If you need formatting, apply it manually using the toolbar after pasting.
Drag and drop images
You can drag an image file from your computer directly onto any editable region. EditlyCMS will upload it automatically and insert it at the cursor position.
Images & Media user
There are two types of image regions in EditlyCMS: inline images (images inside text content) and standalone images such as gallery photos, hero pictures and blog covers (set up by the developer).
Inserting inline images
- Click inside a text region to place your cursor
- Click the Image button in the toolbar
- Either upload a file from your device or paste an image URL
- Add alt text (important for accessibility and SEO)
- Click Insert
Replacing or removing an image
Hover over any image in an editable region. Three controls appear:
- Replace (top-right, blue): opens the image dialog; choose a new file or URL and the picture is swapped in place, keeping its size and position
- Red ✕ (top-right): removes the image
- Blue resize handle (bottom-right): drag to resize the image width
An image that has an empty address shows as a grey box in the editor, so you can still hover it and press Replace.
Uploaded files
All uploaded images and files are stored in cms/uploads/. They are accessible at /cms/uploads/filename.jpg. Files are never automatically deleted; manage them directly via FTP if you need to clean up. Generated social images are kept in cms/uploads/og/.
Uploaded images are stored in the cms/uploads/ folder. If you delete the CMS folder, all uploaded media will be lost. Keep regular backups of this folder.
Draft & Publish user
EditlyCMS uses a draft → publish workflow. Changes you make are never pushed live immediately — they're saved as a draft first, letting you preview and review before going live.
The workflow
Make edits
Click and type in any highlighted editable region. An amber dot appears in the toolbar when there are unsaved changes.
Save as draft
Press Ctrl+S or click Save. Changes are written to a hidden draft file. The live site is untouched. You can close the browser and come back — the draft is preserved.
Preview (optional)
Go back to the dashboard and click View to see the live page. Then click Edit again — the editor loads the draft if one exists.
Publish
Click Publish in the toolbar. EditlyCMS saves the draft, backs up the current live file, then copies the draft to the live file. The page is now updated on your site.
Discarding a draft
If you want to throw away all unsaved changes and revert to the live version, open the ⋯ menu in the toolbar and choose Discard draft. You'll be asked to confirm. This action is permanent — the draft is deleted and cannot be recovered.
The Discard draft option only removes the draft — it does not affect the live site. To undo changes already published to the live site, use the Backups feature.
Unsaved changes warning
If you try to close the browser tab or navigate away with unsaved changes, EditlyCMS will warn you. It also shows a prompt if you click the back arrow with unsaved changes.
Backups user
Every time you publish a page, EditlyCMS automatically creates a backup of the previous live version. Backups are stored privately in cms/data/backups/ with random names, so a backup of a PHP page can never be downloaded or run.
Viewing backups
On the dashboard, click Backups (n) on any page card. The number is how many backups the page has, and the button appears once there is at least one. You'll see a list of all saved versions with timestamps.
Restoring a backup
- Click Backups (n) on the page card
- Find the version you want to restore
- Click Restore — a confirmation dialog appears
- Confirm — the backup becomes the new live version (and the current live gets backed up first)
Restoring a backup automatically backs up the current live version first, so you can always undo a restoration.
Deleting backups
Old backups can be deleted from the backup list to save disk space. Click the Delete button next to any backup, or Delete all to clear every backup of that page at once. This is permanent and cannot be undone.
Template Basics developer
EditlyCMS finds editable pages by scanning all HTML files for the string cms-content. Any file that contains it will appear in the dashboard. Any element with the class cms-content and a unique id will be editable.
The two requirements
To make an element editable, it needs exactly two things:
- The class
cms-content - A unique
idattribute
<!-- Correct — has both class and unique id -->
<h1 class="hero-title cms-content" id="hero-title">
Welcome to Our Site
</h1>
<p class="cms-content" id="hero-subtitle">
We make great things happen.
</p>
<!-- Wrong — missing id -->
<p class="cms-content">This won't be editable</p>
<!-- Wrong — missing class -->
<p id="hero-text">This won't be editable either</p>
Which HTML elements can be editable
| Element | Works? | Notes |
|---|---|---|
<p> | Yes | Best choice for paragraphs |
<h1>–<h6> | Yes | Best for headings |
<span> | Yes | Good for inline text inside other elements |
<div> | Yes | Good for image containers (see Image Regions) |
<a> | Yes | Editable link text; href must be changed via the link modal |
<li> | Yes | Individual list items |
<img> | Limited | Visible in dashboard but save/publish won't update it — use a div wrapper instead (see Image Regions) |
<input> | No | Form inputs cannot be made editable |
Nesting editable elements
Avoid nesting cms-content elements inside each other. EditlyCMS saves the full innerHTML of the outermost editable element, which would overwrite any separately-saved child elements.
<!-- Avoid — nested cms-content will cause conflicts -->
<div class="cms-content" id="section-text">
<p class="cms-content" id="para1">Text here</p>
</div>
<!-- Better — flat siblings -->
<div class="text-block">
<p class="cms-content" id="para1">Text here</p>
<p class="cms-content" id="para2">More text here</p>
</div>
Blog Setup developer
A blog is made of three kinds of page that live in your own HTML, in one folder (usually blog/). No extra software runs on your site: the list of posts is written into your blog page as plain HTML each time something changes. The blog/ folder in the download is a complete, minimal example you can copy.
| Page | What it is | How EditlyCMS recognises it |
|---|---|---|
| Post template | A normal editable page that new posts are copied from | <meta name="editly-blog" content="template"> in the head |
| Blog list | The blog's front page, showing every published post | An element with data-editly-blog-list |
| Post | A page created from the template | The meta tag above, changed to post (or post-draft until first publish) |
1. The post template
Build one post page as you want every post to look, with editable regions, and add the marker and the field attributes:
<head>
<title>New post | My Site</title>
<meta name="description" content="">
<meta name="editly-blog" content="template">
<link rel="stylesheet" href="blog.css">
</head>
<body>
<time class="cms-content" id="post-date" data-editly-field="date" datetime="2026-01-01">1 January 2026</time>
<h1 class="cms-content" id="post-title" data-editly-field="title">Post title</h1>
<p class="cms-content" id="post-excerpt" data-editly-field="excerpt">A short summary.</p>
<div class="cms-content" id="post-image" data-editly-field="image"><img src="images/placeholder.jpg" alt=""></div>
<div class="cms-content" id="post-body">…the text of the post…</div>
</body>
data-editly-field can go on any element. It tells the blog list where to read each value:
| Field | Taken from | If missing, falls back to |
|---|---|---|
title | The text of the element | The page's <title> |
date | The text of the element (any format PHP's strtotime reads, for example 5 March 2026), then its datetime attribute | The file's last-modified date |
excerpt | The text of the element | The meta description, then the first paragraph in an editable region (shortened to about 220 characters) |
image | The first picture inside the element (or the element itself if it is an <img>) | The page's og:image (for example a generated social image); otherwise the list shows no picture |
Put a real placeholder picture in the template's image region (the starter uses images/placeholder.jpg). New posts inherit it, and editors can hover it and press Replace. Image addresses are relative to the post, and are re-based automatically for the list.
The date text is also what new posts are stamped with. By default it is written like 5 March 2026. Change the format with blog_date_format in cms/data/config.php (a PHP date() format, for example 'Y-m-d').
2. The blog list page
On the blog's front page, add a list element with a <template> that describes one entry:
<div data-editly-blog-list data-editly-limit="20">
<template data-editly-item>
<article class="card">
{if image}<a href="{url}"><img src="{image}" alt=""></a>{/if}
<time datetime="{datetime}">{date}</time>
<h2><a href="{url}">{title}</a></h2>
{if excerpt}<p>{excerpt}</p>{/if}
</article>
</template>
</div>
| Placeholder | Value |
|---|---|
{url} | Link to the post, relative to the list page |
{title}, {excerpt} | The post's title and summary (escaped) |
{date} | The date as written in the post |
{datetime} | The date as YYYY-MM-DD, for <time datetime> |
{image} | The cover image address, relative to the list page |
{if image}…{/if} | Keeps the content only when that value exists. Works for image, title, date and excerpt. Cannot be nested. |
Attributes on the list element:
| Attribute | Meaning |
|---|---|
data-editly-limit="10" | Show at most this many posts (newest first). Without it, all posts are listed. |
data-editly-folder="posts" | Folder (relative to the list page) that holds the posts. Without it, posts are looked for in the list page's own folder. Folders are not searched recursively. |
Everything after the <template> inside the list element is generated and replaced on every update. Do not type anything there. Keep other content (headings, an "empty" message) outside the list element. Give the list page at least one cms-content region so it also shows up in the dashboard.
3. How a post lives
- New post copies the template into the same folder, sets
editly-blogtopost-draft, fills in the title and date fields, the<title>andog:title. - The first Publish changes
post-drafttopost. Onlypostpages are listed (and put in the sitemap). - Every publish, restore, rename or delete of a post rebuilds the blog list(s) and, if the draft of the list page exists, its draft too, so a later publish of the list page never brings back an old list.
Posts are read from the live files. You can run several blogs on one site: give each its own folder, template and list.
Styling
The blog is ordinary HTML and CSS; EditlyCMS does not style it. The starter's blog/blog.css is a small, minimal theme (serif headings, generous spacing, two-column cards, automatic dark mode) driven by a few CSS variables at the top of the file.
cms-content Rules developer
IDs must be unique across the entire page
This is the most common source of bugs. The PHP save engine uses the id attribute to find the right element in the HTML file. If two elements share an ID, the engine finds the wrong one and either skips saving or saves to the wrong place.
Critical: Never use the same ID on a cms-content element and a section anchor. For example, if you have <section id="gallery">, do not also use id="gallery" on a cms-content element. Use id="gallery1" or id="gallery-img-1" instead.
<!-- BROKEN — two elements with id="gallery" -->
<section id="gallery">
...
<div class="cms-content" id="gallery"> <!-- same id! -->
<img src="photo.jpg" />
</div>
</section>
<!-- FIXED — unique IDs -->
<section id="gallery">
...
<div class="cms-content" id="gallery1">
<img src="photo.jpg" />
</div>
</section>
Recommended ID naming convention
Use descriptive, section-prefixed IDs so they're easy to identify in the dashboard:
<!-- Hero section -->
<p class="hero-eyebrow cms-content" id="hero-eyebrow">...</p>
<h1 class="hero-title cms-content" id="hero-title">...</h1>
<p class="hero-subtitle cms-content" id="hero-sub">...</p>
<!-- About section -->
<h2 class="cms-content" id="about-title">...</h2>
<p class="cms-content" id="about-p1">...</p>
<p class="cms-content" id="about-p2">...</p>
<!-- Amenities -->
<div class="cms-content" id="am1-title">...</div>
<div class="cms-content" id="am1-desc">...</div>
Special characters in HTML source
EditlyCMS replaces only the inside of each editable region and does not re-write the rest of the file, so comments, symbols (═, ★, →) and other markup outside your regions are left exactly as you wrote them. Text you edit inside a region is saved as normal UTF-8.
Image Regions developer
Making standalone images editable (gallery photos, hero images, etc.) requires a specific pattern. A plain <img class="cms-content"> will not be treated as an editable region (it is not listed in the dashboard and cannot be saved) because:
- An editable region must be a closed element with content between its tags.
<img>is self-closing and has none - The CMS save engine uses
innerHTML— a plain<img>has no innerHTML - The image resize/delete buttons in the editor are injected into a parent element, not onto the img itself
The correct pattern
Wrap each image in a <div> with cms-content. The div is the editable container; the img lives inside it.
<!-- Correct — div wrapper with cms-content, img inside -->
<div class="img-cell cms-content" id="hero-photo">
<img src="images/hero.jpg" alt="Hero image" />
</div>
<!-- Wrong — img directly as cms-content -->
<img class="cms-content" id="hero-photo" src="images/hero.jpg" />
Gallery grid pattern
When using CSS Grid for galleries, the wrapper div needs height:100% to fill its grid cell, and the image fills the div:
.gallery-grid {
display: grid;
grid-template-columns: 2fr 1fr 1fr;
grid-template-rows: 280px 280px;
gap: 8px;
/* Allow CMS edit buttons to overflow the grid boundary */
overflow: visible;
padding: 32px;
margin: -32px;
}
.gallery-grid .img-cell {
display: block;
height: 100%; /* fills the grid row height */
overflow: hidden; /* clips the image to the cell */
}
.gallery-grid .img-cell img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
<div class="gallery-grid">
<div class="img-cell span2 cms-content" id="gallery1">
<img src="images/gallery1.jpg" alt="Main photo" />
</div>
<div class="img-cell cms-content" id="gallery2">
<img src="images/gallery2.jpg" alt="Photo 2" />
</div>
<div class="img-cell cms-content" id="gallery3">
<img src="images/gallery3.jpg" alt="Photo 3" />
</div>
</div>
The padding: 32px; margin: -32px trick on the grid gives the CMS edit buttons (which are position:absolute inside each cell) room to appear outside the grid cell boundaries without affecting the visual layout.
The edit-mode wrapper
While you edit, the CMS wraps every image in a small <span class="cms-iw"> so it can show the delete and resize buttons. The wrapper is inline-block, so an image styled with width:100%; height:100% can shrink or collapse in edit mode even though the live page looks fine. Tell the wrapper to fill its cell:
.img-cell .cms-iw {
display: block;
width: 100%;
height: 100%;
}
The wrapper exists only while editing. It is removed again when you save, so it never reaches your published HTML.
Common Gotchas developer
Files not appearing in the dashboard
EditlyCMS only lists files that contain the string cms-content. If a file doesn't appear:
- Confirm at least one element has
class="cms-content" - Confirm the file is
.html,.htm, or.php - Confirm the file is not inside the
cms/subfolder - Confirm the editable element has a closing tag
Edits save but don't appear on the live site
You've saved a draft but haven't published. Click Publish in the toolbar. A Draft tag on the page card in the dashboard means unpublished changes exist.
Saves appear to work but nothing changes
Almost always caused by a duplicate ID. Check your HTML — if a cms-content element shares an ID with any other element on the page (especially section anchors like <section id="about">), the save engine finds the wrong element and skips it. Rename the cms-content element's ID to something unique.
Gallery images are visible but edit/delete buttons don't appear
The edit buttons require the image to be a child of a data-cms-editable element. If cms-content is directly on the <img> tag, the buttons won't appear. Use the div wrapper pattern described in Image Regions.
Images are missing from the dashboard
An editable region must be a closed element. A self-closing <img class="cms-content"> is ignored. Wrap the image in a <div class="cms-content">.
CSS Grid images collapsing to zero height
When an image wrapper div is inside a CSS Grid and the img is position:absolute, the div collapses to zero height because it has no content in normal flow. Fix: add height:100% to the wrapper div so it fills its grid row.
Images look wrong only while editing
In edit mode the CMS wraps each image in a <span class="cms-iw">, which is inline-block by default. An image with width:100%; height:100% can shrink or collapse inside it even though the live page looks fine. Make the wrapper fill its cell, as described in Image Regions.
Images work locally but not on server
Check case sensitivity. Linux servers are case-sensitive — if your folder is named Images/ but your HTML references images/, the image won't load. Rename folders to lowercase. Also check for spaces in filenames — Windows sometimes adds trailing spaces during rename operations.
My PHP page lost its output while editing
The editor shows a page without running it, so anything PHP generates (an included header, a loop) is not displayed while you edit. PHP inside an editable region appears as a small locked PHP chip and is saved back unchanged. Publishing never changes your PHP.
A new blog post is not in the blog list
Posts are listed only after their first publish. Open the post, press Save, then Publish. Also check that the list page's data-editly-blog-list element contains a <template data-editly-item>, that the post is in the folder the list reads (data-editly-folder), and press Settings → Blog → Update blog lists now.
The blog list shows no pictures, or the wrong date
Pictures come from the element marked data-editly-field="image" (or the page's og:image). The date is read from the visible text, so write it in a form PHP understands (5 March 2026); month names in other languages are not understood, and the datetime attribute is used instead.
Blog pages show text but no styles or images in the editor (local servers)
The editor loads your CSS and images from the page's own folder. If they fail only on a local server (WAMP, XAMPP), a rule in the server configuration or a .htaccess above the site may be intercepting that folder's address (a proxy, rewrite or alias for a path such as /blog). Compare with another folder, and check the Apache error log.
"The PHP GD extension is switched off"
Social images need GD with FreeType. On XAMPP/WAMP open php.ini, remove the ; in front of extension=gd and restart Apache. On shared hosting enable GD in the PHP settings panel. Sitemaps do not need GD.
"A sitemap.xml already exists that EditlyCMS did not create"
EditlyCMS only overwrites sitemaps that carry its own marker. Rename or delete the existing file, then generate again.
Links broke after renaming a page
Renaming changes the file name only. Other pages that linked to the old name still point to it; update those links by hand.
A page is missing from the dashboard
The page needs an element with both class="cms-content" and a unique id, and that element must be closed properly (for example <p>…</p>). A file that only contains the words "cms-content" is not listed.
File Structure developer
Files EditlyCMS writes outside cms/
| File | When |
|---|---|
Your pages (.html, .htm, .php) | Publish, restore, rename, social image (head tags), and the blog list of a list page |
| New copies of pages | Duplicate and New post (same folder as the original) |
sitemap.xml | Generate sitemap, and automatic updates (main folder and each separate site's folder) |
Only the one deletion is possible from the dashboard: blog posts (and their draft, backups and social image).
Draft files
When you save a draft of index.html, a full copy of the page with your changes is stored in cms/data/drafts/ under a name derived from a per-site secret. Nothing is written next to your live pages. The draft is deleted when you publish or discard.
Backup files
Backups are stored in cms/data/backups/ with random names ending in .bak. The database records which page each belongs to.
Database schema
The SQLite database (cms/data/editly-<random>.db) has these tables. Only the two main ones are shown; the others hold users, media records, settings and login attempts. SEO settings (sites, colours, automatic updates, sitemap exceptions) are stored as one JSON value under the key seo in the settings table. Blog roles live in the pages themselves, not in the database.
-- Tracks each discovered page
CREATE TABLE pages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
path TEXT UNIQUE NOT NULL, -- relative path e.g. "blog/hello.html"
title TEXT, -- extracted from <title> tag
has_draft INTEGER DEFAULT 0,
last_edited DATETIME,
last_published DATETIME
);
-- Tracks backup files for each page
CREATE TABLE backups (
id INTEGER PRIMARY KEY AUTOINCREMENT,
page_path TEXT NOT NULL,
backup_file TEXT NOT NULL, -- filename in cms/data/backups/
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
PHP API Reference developer
All API endpoints are routed through cms/index.php via the ?action= query parameter. All responses are JSON.
Every action except pages, get_page, check_auth, seo_get and og_status must be a POST and must send the session's anti-CSRF token in an X-CSRF-Token header. Without it the API answers 403. The token is provided to the dashboard and editor pages when they load, so use the CMS's own screens rather than calling the API from other sites.
Authentication endpoints
| Action | Method | Parameters | Description |
|---|---|---|---|
setup | POST | username, password | Create the first account (only works while no account exists) |
login | POST | username, password | Start a session (rate limited, answers 429 when locked out) |
logout | POST | — | Destroy the session |
change_password | POST | current, new | Change password (auth required) |
change_username | POST | password, username | Change username (auth required) |
check_auth | GET | — | Returns {"authenticated": true/false} |
Page endpoints
| Action | Method | Body | Description |
|---|---|---|---|
pages | GET | — | List all CMS pages with metadata and backups |
get_page | GET | ?path= | Get current contents of a page |
save_draft | POST | {path, contents} | Save changes to a draft file |
publish | POST | {path} | Publish draft to live (creates backup first) |
discard | POST | {path} | Delete draft, revert to live |
restore_backup | POST | {path, backup} | Restore a backup as the live version |
delete_backup | POST | {path, backup} | Permanently delete a backup file |
duplicate | POST | {path, title, name, date?} | Copy a page into the same folder. On a blog template, creates an unlisted post (date is optional). Returns {path, kind, warnings} |
rename_page | POST | {path, title, name} | Change title and/or file name (empty name keeps it). Moves the draft and backups |
delete_page | POST | {path} | Delete a blog post, with its draft, backups and social image. Refuses anything that is not a blog post |
Blog and SEO endpoints
| Action | Method | Body | Description |
|---|---|---|---|
blog_refresh | POST | — | Rebuild every blog list on the site. Returns {updated} |
seo_get | GET | — | Sites, colours, automatic-update flag, sitemap status and whether social images are available |
seo_save | POST | {sites, og, auto, exclude} | Save the SEO settings |
sitemap_generate | POST | — | Write sitemap.xml for each site. Returns a result per site |
og_status | GET | ?path= | Whether a page has a social image, and its preview address |
og_generate | POST | {path} | Draw the page's social image and add the meta tags |
Media endpoints
| Action | Method | Parameters | Description |
|---|---|---|---|
upload_image | POST | file (multipart) | Upload an image, returns {success, url} |
upload_file | POST | file (multipart) | Upload any file, returns {success, url} |
delete_media | POST | {path} | Delete an uploaded file from disk |
The save_draft payload
The contents object is a map of element IDs to their new innerHTML:
{
"path": "index.html",
"contents": {
"hero-title": "New headline text",
"hero-sub": "Updated subheading here",
"gallery1": "<img src=\"/cms/uploads/photo.jpg\" alt=\"New photo\" />"
}
}
How saving works
The save logic lives in Html.php and Pages.php. It does not parse and re-write the whole page. Instead:
- PHP blocks (
<?php … ?>,<?= … ?>) are located with PHP's own tokenizer and set aside, so they are never treated as HTML - Each element with
class="cms-content"and the matchingidis found, along with the exact byte range of its inner HTML - The new content is sanitised on the server, and only that byte range is replaced. Everything else in the file is preserved byte for byte
- The PHP blocks are put back, the file is checked to still contain all of its regions, and it is written to a private draft (or, on publish, replaced atomically after a backup)
The sanitiser removes <script>, <object>, <embed>, <base>, <meta>, on… attributes and unsafe URLs, keeps iframes only for YouTube, Vimeo and Google Maps, and neutralises any PHP tag. It also removes the editor's own attributes (contenteditable, data-cms-editable) and image-resize wrappers.
Because only the region is replaced, regions must be closed elements. Nested editable regions are not supported.
Optional settings file
Create cms/data/config.php returning an array to change these. Most sites need none of it.
<?php
return [
// Behind Cloudflare or another proxy: count real visitors in the login limit
'client_ip_header' => 'HTTP_CF_CONNECTING_IP',
// Extra downloadable file types to accept
'allowed_file_extensions' => ['pdf', 'docx', 'zip', 'psd'],
// How new blog posts write their date (PHP date() format; default 'j F Y')
'blog_date_format' => 'j F Y',
];
Security developer
What EditlyCMS does for you, and what is left to your server.
| Area | What it does |
|---|---|
| Accounts | No default password. Passwords are hashed with bcrypt. Login is rate limited (5 failures, 15 minutes), takes equal time for unknown users, and starts a fresh session. |
| Sessions | Own cookie name, HttpOnly, SameSite=Lax, Secure on HTTPS. Stored privately in cms/data/sessions/. 4 idle hours or 12 hours total. |
| Requests | Every change needs POST plus a CSRF token, and the Origin must match your site. |
| Pages | Only existing .html, .htm or .php files with an editable region, inside the site and outside cms/, can be read or changed. Paths are resolved to their real location. |
| Storage | Database, drafts, backups and sessions live in cms/data/ with random names and are blocked from the web. |
| Uploads | Allow-list of types, images verified by content, random names, script extensions refused by the uploads folder. |
| Content | Sanitised on the server. PHP tags can never be saved into a page. |
| Blog and SEO | Only blog posts can be deleted from the dashboard. Duplicate and rename stay inside the page's own folder and validate file names (letters, numbers, hyphens). Social images are generated PNG files with fixed names; the sitemap never overwrites a file it did not create. Editing a page's head (social image tags) always makes a backup first. |
| Errors | PHP errors are logged, never shown to visitors. |
Web server setup
Apache works as shipped (keep AllowOverride All so the .htaccess files in cms/ apply).
Nginx ignores .htaccess, so add these inside your server block:
location ~ ^/cms/(data|api|views)/ { deny all; return 404; }
location ~* ^/cms/uploads/.*\.(php[0-9]?|phtml|pht|phar|cgi|pl|py|sh)$ { deny all; return 404; }
IIS reads the web.config that EditlyCMS creates in cms/data/.
Keep PHP up to date and use HTTPS. Run a PHP version that still receives security fixes, and always serve the CMS over HTTPS.
Change Password user
Open Settings
From the dashboard, click Settings in the top-right header.
Go to the Password tab
Click the Password tab inside the settings panel.
Enter current and new password
Fill in your current password and your desired new password, then click Update password.
Change Username user
Open Settings
From the dashboard, click Settings in the top-right header.
Go to the Username tab
Click the Username tab inside the settings panel.
Enter your password and new username
Your current password is required to change the username. Enter the new username and click Update username.