1

I am a beginner to Craft CMS. I have an HTML design for Craft integration. I need to covert this to a live URL page on my website. Also, I need to manage its content from the backend. I think we need to do something related to entries, but I don't know what part I need to do first and what to do second, etc. Can anyone please help for the steps needed for this?

Thanks in advance.

1

I would first suggest getting your static HTML site up and running with twig, then slowly adding dynamic elements as you learn more about Craft.

Start with two template files _layout.twig and index.twig. _layout.twig is the file that all pages will extend, so it will contain all your html meta, css, js, etc. Within the _layout.twig you can define areas that can have content injected into, so in the example below I have the 'content' block.

_layout.twig:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>title</title>
  </head>
  <body>
      {% block content %}
         Content will go here, if no content found this message will display.
      {% endblock %}
  </body>
</html>

We can then extend the layout from the index.twig page by defining the content area.

index.twig, accessible from yourdomain.com/index (or yourdomain.com)

{% extends '_layout' %}

{% block content %}
    <div>
        <h1>I love puppy dogs</h1>
        <p>Puppy dogs love me</p>
    </div>
{% endblock %} 

After that, once you have created your first section you will be able to make your pages dynamic.

index.twig

{% extends '_layout' %}

{% block content %}
    <div>
        <h1>{{ entry.title }}</h1>
        {{ entry.body }}
    </div>
{% endblock %} 

In terms of creating sections and entries you will need to invest some time looking at the available resources then post here or jump on the discord server if you need help with specific things.

| improve this answer | |
  • Thank you very much. I will try this one – Rakhi Vijayan Nov 12 '19 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.