On this page
EditlyCMS — Complete Documentation

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.

Version 1.3.0  ·  SQLite3  ·  No dependencies

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:

  1. Reads the page (or its saved draft) from disk. PHP code is set aside and never sent to the browser
  2. Injects a floating toolbar at the bottom of the page
  3. Makes all cms-content elements directly editable (they show a dashed blue outline)
  4. When you save, stores your changes in a private draft in cms/data/drafts/, not next to the live page
  5. 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.)
i

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 and og:url are 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:image tags. 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.php is 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.php and the font files in cms/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

RequirementDetails
PHPA current, supported PHP version (8.1 or newer is a good choice), with the PDO SQLite extension. Almost every host has both.
ExtensionsPDO SQLite, DOM, JSON, Session (all enabled by default on almost every host). mbstring is not needed.
Optional: GD with FreeTypeOnly 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 folderscms/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 filesMust be in the same folder as cms/ or in subfolders

Setup steps

01

Upload the cms/ folder

Place the cms/ folder in the root of your website — the same folder that contains your HTML files.

02

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.

03

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.

04

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

your-website/
index.html ← your site files
about.html
images/
cms/ ← EditlyCMS lives here
index.php ← router & entry point
data/ ← private, auto-created: database, drafts, backups, sessions
api/
Auth.php
Pages.php
Media.php
Database.php
Html.php ← finds and replaces editable regions
Security.php ← sessions, CSRF, headers
Storage.php ← private folders
Blog.php ← blog posts and the post list
Seo.php ← sitemap and social images
fonts/ ← font used for social images
views/
dashboard.php
edit.php
login.php
uploads/ ← public: your uploaded images and files, and og/ (generated social images)

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.

FieldRule
Username3 to 32 characters: letters, numbers, _ . -
Password10 to 72 characters, and not something obvious like admin
i

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.

The Editly CMS dashboard: a blog folder tile and page cards with live previews
The dashboard. The blog folder is a tile in the same grid, and the Gallery card carries a Draft tag.

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 example About | 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

ButtonWhat it does
EditOpens the page in edit mode with the floating toolbar. Clicking the preview does the same.
New postOnly on a blog post template: creates a new blog post from it and opens the editor.
ViewOpens 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

  1. Open the ⋯ menu on the card and choose Duplicate…
  2. Enter a title. The file name is suggested from it (letters, numbers and hyphens); change it if you like
  3. 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).

Inside a blog folder: the blog list, the post template with its New post button, and posts with date badges
A blog folder. The post template has a New post button, and each post shows its date.

Write a new post

  1. In the dashboard, open the folder that holds the blog
  2. On the Blog post template card, click New post
  3. Enter the title and, if you wish, a date. Click Create post
  4. 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 / .htm page, and every .php page that has editable regions
  • index pages 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/*.

i

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.

A page in edit mode with dashed outlines around editable regions and the toolbar at the bottom
Edit mode. The headline is hovered, so its outline is solid and its ID is shown.
i

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.

ControlActionShortcut
Back arrowReturn to the dashboard. If you have unsaved changes you are asked first.—
Style ▾Change paragraph style: paragraph, headings 1–4, quote or code block—
B I UBold, italic and underline the selected textCtrl+B / I / U
Colour swatchChange text colour. Select text first, then pick a colour.—
Bulleted and numbered listTurn the current paragraph into a list—
LinkInsert a hyperlink—
ImageInsert an image by upload or URL—
More ▾Open the More menu, described below—
SaveSave changes as a draftCtrl+S
PublishSave the draft and push it to the live site. A backup of the previous version is made first.—
⋯Open the menu with Move toolbar and Discard draft, described below—

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.

The More menu open above the toolbar, showing strikethrough, indent, alignment, undo and redo buttons and three embed options
The More menu.
ItemActionShortcut
StrikethroughStrike through the selected text—
Indent / OutdentIndent or outdent a list item or paragraph—
Align left / centre / rightAlign the current paragraph—
Undo / RedoStep back or forward through your editsCtrl+Z / Y
Embed videoEmbed a YouTube or Vimeo video—
Embed mapEmbed a Google Map—
Upload fileUpload 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

  1. Select the text you want to turn into a link
  2. Click the Link button
  3. Enter the URL and optionally choose to open in a new window
  4. Click Insert link
i

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

  1. Click inside the editable region where you want the video
  2. Open More and choose Embed video
  3. Paste a YouTube or Vimeo URL (not an embed URL — just the regular page URL)
  4. Set width and height as needed
  5. Click Embed video

Embedding a Google Map

  1. In Google Maps, open the location you want
  2. Click Share → Embed a map and copy the src="..." URL from the iframe code
  3. In EditlyCMS, open More, choose Embed map and paste that URL
  4. 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

  1. Click inside a text region to place your cursor
  2. Click the Image button in the toolbar
  3. Either upload a file from your device or paste an image URL
  4. Add alt text (important for accessibility and SEO)
  5. 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

01

Make edits

Click and type in any highlighted editable region. An amber dot appears in the toolbar when there are unsaved changes.

02

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.

03

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.

04

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.

i

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

  1. Click Backups (n) on the page card
  2. Find the version you want to restore
  3. Click Restore — a confirmation dialog appears
  4. Confirm — the backup becomes the new live version (and the current live gets backed up first)
i

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:

  1. The class cms-content
  2. A unique id attribute
HTML
<!-- 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

ElementWorks?Notes
<p>YesBest choice for paragraphs
<h1>–<h6>YesBest for headings
<span>YesGood for inline text inside other elements
<div>YesGood for image containers (see Image Regions)
<a>YesEditable link text; href must be changed via the link modal
<li>YesIndividual list items
<img>LimitedVisible in dashboard but save/publish won't update it — use a div wrapper instead (see Image Regions)
<input>NoForm 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.

HTML
<!-- 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.

PageWhat it isHow EditlyCMS recognises it
Post templateA normal editable page that new posts are copied from<meta name="editly-blog" content="template"> in the head
Blog listThe blog's front page, showing every published postAn element with data-editly-blog-list
PostA page created from the templateThe 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:

HTML
<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:

FieldTaken fromIf missing, falls back to
titleThe text of the elementThe page's <title>
dateThe text of the element (any format PHP's strtotime reads, for example 5 March 2026), then its datetime attributeThe file's last-modified date
excerptThe text of the elementThe meta description, then the first paragraph in an editable region (shortened to about 220 characters)
imageThe 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
i

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:

HTML
<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>
PlaceholderValue
{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:

AttributeMeaning
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

  1. New post copies the template into the same folder, sets editly-blog to post-draft, fills in the title and date fields, the <title> and og:title.
  2. The first Publish changes post-draft to post. Only post pages are listed (and put in the sitemap).
  3. 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.

HTML — Common mistake
<!-- 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:

HTML
<!-- 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:

  1. An editable region must be a closed element with content between its tags. <img> is self-closing and has none
  2. The CMS save engine uses innerHTML — a plain <img> has no innerHTML
  3. 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.

HTML
<!-- 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:

CSS
.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;
}
HTML
<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>
i

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:

CSS
.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

cms/
index.php ← router: handles all actions, login, edit mode, dashboard
admin/ ← the address you visit (/cms/admin/); its index.php just hands over to ../index.php
data/ ← private: database, drafts, backups, sessions, config.php (never served)
api/
Auth.php ← setup, login, rate limiting, change password/username
Security.php ← sessions, CSRF token, response headers
Html.php ← region finder, PHP preservation, sanitiser, head/meta helpers
Storage.php ← private folders
Pages.php ← list, save, publish, discard, backups, duplicate, rename, delete post, blog refresh
Blog.php ← post roles, fields, new-post stamping, list rendering
Seo.php ← site settings, sitemap, social images
Media.php ← image upload, file upload, delete media
Database.php ← SQLite wrapper with schema initialization
fonts/ ← Inter Regular and Bold (SIL OFL) for social images
views/
login.php ← login page HTML+JS (also setup.php, force_password.php)
dashboard.php ← dashboard HTML+JS
edit.php ← editor toolbar+JS injected into site pages
uploads/ ← uploaded images and files (public)
og/ ← generated social images (public)

Files EditlyCMS writes outside cms/

FileWhen
Your pages (.html, .htm, .php)Publish, restore, rename, social image (head tags), and the blog list of a list page
New copies of pagesDuplicate and New post (same folder as the original)
sitemap.xmlGenerate 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.

SQL
-- 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

ActionMethodParametersDescription
setupPOSTusername, passwordCreate the first account (only works while no account exists)
loginPOSTusername, passwordStart a session (rate limited, answers 429 when locked out)
logoutPOST—Destroy the session
change_passwordPOSTcurrent, newChange password (auth required)
change_usernamePOSTpassword, usernameChange username (auth required)
check_authGET—Returns {"authenticated": true/false}

Page endpoints

ActionMethodBodyDescription
pagesGET—List all CMS pages with metadata and backups
get_pageGET?path=Get current contents of a page
save_draftPOST{path, contents}Save changes to a draft file
publishPOST{path}Publish draft to live (creates backup first)
discardPOST{path}Delete draft, revert to live
restore_backupPOST{path, backup}Restore a backup as the live version
delete_backupPOST{path, backup}Permanently delete a backup file
duplicatePOST{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_pagePOST{path, title, name}Change title and/or file name (empty name keeps it). Moves the draft and backups
delete_pagePOST{path}Delete a blog post, with its draft, backups and social image. Refuses anything that is not a blog post

Blog and SEO endpoints

ActionMethodBodyDescription
blog_refreshPOST—Rebuild every blog list on the site. Returns {updated}
seo_getGET—Sites, colours, automatic-update flag, sitemap status and whether social images are available
seo_savePOST{sites, og, auto, exclude}Save the SEO settings
sitemap_generatePOST—Write sitemap.xml for each site. Returns a result per site
og_statusGET?path=Whether a page has a social image, and its preview address
og_generatePOST{path}Draw the page's social image and add the meta tags

Media endpoints

ActionMethodParametersDescription
upload_imagePOSTfile (multipart)Upload an image, returns {success, url}
upload_filePOSTfile (multipart)Upload any file, returns {success, url}
delete_mediaPOST{path}Delete an uploaded file from disk

The save_draft payload

The contents object is a map of element IDs to their new innerHTML:

JSON
{
  "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 matching id is 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.

i

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
<?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.

AreaWhat it does
AccountsNo 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.
SessionsOwn cookie name, HttpOnly, SameSite=Lax, Secure on HTTPS. Stored privately in cms/data/sessions/. 4 idle hours or 12 hours total.
RequestsEvery change needs POST plus a CSRF token, and the Origin must match your site.
PagesOnly 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.
StorageDatabase, drafts, backups and sessions live in cms/data/ with random names and are blocked from the web.
UploadsAllow-list of types, images verified by content, random names, script extensions refused by the uploads folder.
ContentSanitised on the server. PHP tags can never be saved into a page.
Blog and SEOOnly 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.
ErrorsPHP 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:

nginx
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

01

Open Settings

From the dashboard, click Settings in the top-right header.

02

Go to the Password tab

Click the Password tab inside the settings panel.

03

Enter current and new password

Fill in your current password and your desired new password, then click Update password.

Change Username user

01

Open Settings

From the dashboard, click Settings in the top-right header.

02

Go to the Username tab

Click the Username tab inside the settings panel.

03

Enter your password and new username

Your current password is required to change the username. Enter the new username and click Update username.