This page is a work in progress, tests needed. Silex is free/libre software which means you need to contribute.
This tutorial is very long but it should work fine if you follow each step. If you would like us to develop a WordPress plugin that makes it a little easier, you can vote for this feature here
You may want to check this video too, it is an other attempt to document the WordPress integration
By the end of this tutorial, you will have a WordPress backend to edit your website. The frontend will be designed with Silex drag and drop interface and it will be hosted on GitLab pages for free.
Requirements: you need **a regular WordPress website. Local WordPress (development) will not work because Silex and GitLab will not be able to access it.
This guide includes all the setup necessary to make your WordPress ready for Silex. We will install a number of plugins such as SCF (ex-ACF)
Feel free to ask in the chat or forums if you need explanations about why this step or that action
Let's start from your WordPress admin, click on "add new plugin" from the "plugin" tab.
Fill "Secure Custom Fields."
Initiate the installation process.
Activate the plugin.
Let's add another plugin.
Enter "WPGraphQL" in the search field.
Initiate the installation process.
Activate the plugin.
Add a new plugin.
Fill in the search box with "WPGraphQL ACF."
Initiate the installation process.
Activate the plugin.
Access the settings.
Set the GraphQL API endpoint.
Select "Enable Public Introspection."
Save the changes made.
Switch to "v3.silex.me."
Access Silex with your GitLab account.
Say hi to the dashboard, create a new empty site.
Click on the specified location.
Access the CMS section.
Click on the "Add data source" button.
Enter information in the field that was the value "Endpoint."
Make sure that this does not display any error.
Apply the changes.
Add a text to your site.
Drag a text to the canvas.
Open the settings of the new text block.
Add an expression in the loop field.
When you will publish your site, it will duplicate the text field, one per page in WordPress.
The "{ }" next to "Pages" means it is an object, not an array.
The "[ ]" next to "nodes" means it is an array of pages. You can loop on that.
When you publish your site, it will duplicate the text field, one per page in WordPress.
This will make the content of the text field an expression. When you publish your site, the text content will be replaced by the expression you select.
Loop data is the one page that the text field represents.
The pages have a title, so you can make the text field display the page title.
When you publish your site, the text content will be replaced by the page title.
Publish the changes.
Select GitLab to publish to GitLab pages hosting (free and good quality).
Publish the website. Wait 30 seconds.
Access the live website link.
Here is your website, with one text field for the one page that WordPress has by default.
Copy the URL of your website for later use (the address in the address bar).
Back to WordPress, add a new plugin.
Search for the Faust plugin (will make your WordPress truly headless).
Initiate the installation process.
Activate the plugin.
Access "Faust."
Paste the front-end site URL that you got from step 40.
Save the changes made.
Visit the site.
Add a new plugin.
The "JAMStack deployment" plugin will add a button to update your frontend when you edit content in WordPress (no need to publish from Silex).
Initiate the installation process.
Activate the plugin.
Access the Deployments section.
Switch to the app "v3.silex.me."
Access GitLab Pages settings.
This brings you to GitLab:
This is not needed with newer versions of Silex, skip this step unless you have issues
Here you need to edit a file in gitlab: click on the name of your project to see the files. Click on .gitlab-Ci.yml
Now click "edit" button then "edit single file":
It should contain something like this:
# silexOverwrite: true
# You will want to remove these lines if you customize your build process
# Silex will overwrite this file unless you remove these lines
# This is the default build process for plain eleventy sites
image: node:20
pages:
stage: deploy
environment: production
script:
- npx @11ty/eleventy@v3.0.0-alpha.20 --input=public --output=_site
- mkdir -p public/css public/assets && cp -R public/css public/assets _site/
- rm -rf public && mv _site public
- echo "The site will be deployed to $CI_PAGES_URL"
artifacts:
paths:
- public
rules:
- if: '$CI_COMMIT_TAG'
Remove the first line and add this line at the end, after the last line:
- if: '$CI_PIPELINE_SOURCE == "trigger"'
Make sure you respect indentation, it should be like this (you can also replace the whole content with this):
# You will want to remove these lines if you customize your build process
# Silex will overwrite this file unless you remove these lines
# This is the default build process for plain eleventy sites
image: node:20
pages:
stage: deploy
environment: production
script:
- npx @11ty/eleventy@v3.0.0-alpha.20 --input=public --output=_site
- mkdir -p public/css public/assets && cp -R public/css public/assets _site/
- rm -rf public && mv _site public
- echo "The site will be deployed to $CI_PAGES_URL"
artifacts:
paths:
- public
rules:
- if: '$CI_COMMIT_TAG'
- if: '$CI_PIPELINE_SOURCE == "trigger"'
Click "Commit changes" to save and you're done
Access the CI/CD section.
Click the selected location.
Access trigger token usage examples.
Switch back to WordPress, paste the URL you got from the previous step.
Navigate to "gitlab.com."
Click on the "copy" button next to the token you previously created.
Access the trigger pipeline URL and replace TOKEN with the token.
Replace the word "REF_NAME" with "main."
Take only the part in href="THIS ADDRESS."
It is the part like src="THIS URL."
Click to save the settings.
Thanks to this new plugin, we can initiate a website deployment.
The badge appears here and updates automatically.
Access the pages section.
Select to add a new page.
Click to publish the page.
Click to really publish the page.
This will close the page editor.
Initiate the website deployment process.
Wait until it is green.
Access the website.
The site has been updated with WordPress content.
Now you can add content to your WordPress site and edit the design in Silex. Next step will probably be to use ACF to create content types and advanced designs. For now, you should ask for guidance in the chat or forums.