1

I'm trying to wrap my head around how I can go into the Netlify CMS and be able to edit the home page texts using Hugo. Days of research is leading me nowhere since all documents are about doing blog posts.

Right now I have my Netlify config.yml in the static/admin and an index.html file in the layouts folder. What do I need to do to be able to go into the Netlify dashboard and edit fields which will change texts on home page?

If I were to make the index.html as a markdown file in the content folder, how can I pull that data within the index.md to the index.html that lives in the layout folder?

3 Answers3

0

If netlifycms is already in the site and that site is on netlify, then the next step is to add your account as a user to the site.

  • Open the site in the app.netlify.com/sites
  • Click on the Identity tab
  • Invite users
  • Accept invitation
  • Open up YOURDOMAIN.COM/admin page
  • Netlify will prompt for a login

I've had the same problem figuring out how to do netlifycms. Instructions are generally weak on where one does what. Sometimes creating an account/password is also problematic. Good luck!

jeffmcneill
  • 2,052
  • 1
  • 30
  • 26
0

Your index.html would need to be something like:

{{ define "main" }}
<article>
  <h1>{{.Title}}</h1>
  {{.Content}}
  <!-- any other homepage html -->
</article>
{{ end }}

And then that will be populated with the content of content/_index.md in the same way as any other content page.

---
title: My homepage
date: 2020-04-24T10:48:46.000Z
---
User-editable homepage content, easily managed with Netlify CMS
Seth Warburton
  • 2,234
  • 1
  • 16
  • 17
0

Contents for the home page has to be in content/_index.md (or _index.en.md for multilingual). If your netlify-cms config for pages collection does not match this (for example if you keep your pages in content/pages/*.md), then you need a special collection configured with file: content/_index.md.

merwok
  • 6,779
  • 1
  • 28
  • 42