Skip to content

Create templates for Silex

Alex Hoyau edited this page May 28, 2024 · 11 revisions

This wiki is obsolete, it concerns Silex v2

⚠️ WARNING: Support for Silex v2 has stopped.

Go to Silex v3 documentation instead,

Try Silex v3 here,

Read about it,

Subscribe to the newsletter (En francais ici


Silex templates are ready to use websites you can edit to change the content and make it your website.

You need to create the templates in Silex, you can not use HTML templates. Silex websites have specific HTML markup for Silex to manage pages, drag/drop zones etc.

Creative commons templates

What makes a good creative commons template ready to add to Silex templates:

  • Little or no CSS - at least do not make editing complex
  • Creative Commons license
  • Text styles that make customization as easy as possible
  • Hosted on Github
  • Use the same nomenclature as the official templates: editable.html, images in assets/ screenshot.png, etc. see the official templates repository which holds the templates which appear in the dashboard by default.

screenshot from 2019-02-26 12-11-06

Add templates to your own instance

Here is the code which is explained in this section

You can add templates on your instance only and for your users only. For that, follow the instructions of the page How To Add Silex To Your Node.js Project.

Then you add templates in Silex templates folder and that is all.

Create the templates

Look at the templates of the official repository of templates. They all have 1 folder per template with these files in it: editable.html, index.html, screenshot.png, README.md and all the files which are generated when publishing the template with Silex.

In your project (the one created from the instructions of How To Add Silex To Your Node.js Project), add the created templates to the folder node_modules/silex-templates/.

Start Silex as explained in the page How To Add Silex To Your Node.js Project, open http://localhost:6805/ and you should see your templates on the Dashboard.

customize silex add template

Make things right

Now that it works, you need to cleanup all this. You are not supposed to write in the node_modules folder. If you do, when you update Silex, you will loose all your changes.

Create a folder templates/ in your project (the one created from the instructions of How To Add Silex To Your Node.js Project). Put your templates in this folder. Add this to your package.json:

{
  "build": "cp -r templates/* node_modules/silex-templates/",

WARNING: Support for Silex v2 has stopped. Try Silex v3 alpha, Read about it, Subscribe to the newsletter

Clone this wiki locally