Search code examples
pluginsstatic-pagesoctobercms

In October CMS, how can I make an image editable in a Static Page?


I'd like to set up a generic marketing template using the October CMS "Static Pages" plug-in. The intention is to allow my clients to create their own marketing pages. Let's assume that my layout contains HTML similar to this:

<img src="/path/to/image.jpg">
<hr>
<p>Some uneditable copy</p>

{% placeholder copy default title="Main Page Copy" type="html" %}
  <h1>Some Awesome Headline</h1>
  <p>Sea no omnium deserunt, eum tale movet sensibus te.</p>
{% endplaceholder %}

How could I allow my clients to change the image?


Solution

  • You have a full explenation here https://octobercms.com/blog/post/building-client-friendly-websites

    Add this code to your layout

    {variable name="banner" label="Banner" tab="Header" type="mediafinder" mode="image"}{/variable}
    

    and this into your html markup

    <img src="{{ banner|media }}" alt="" />
    

    You will see the extra field in your backend