TransWikia.com

Where does Craft store HTML Templates?

Craft CMS Asked by Jordan Rennick on May 18, 2021

I have recently been given access to a Craft site’s control panel. I need to edit the homepage to add data in the footer. As I didn’t create the Craft website, how can I access the HTML I need to add the code?

I’ve seen tutorials opening it from your localhost but as this is on an external server I am unaware how to access it.

One Answer

It sounds like you have access to the CP, but not the server.

In order to modify the template files (usually stored in the templates directory, next to the public web folder), you'll need SSH or FTP access to the server itself.

For example, if your site's web root was here:

/home/username/website.com/web

…your templates folder is probably here, out of public view, but still accessible to Craft:

/home/username/website.com/templates

To find the template you need to edit, look in Settings → Sections -> Section Name, under the "Site Settings" heading. This table will show you what template is rendered (relative to the templates directory, above) for each type of content defined in the CP.

Depending on how the site is structured, each page may be assembled from many Twig "includes," so not all the HTML for a page will be present in the primary template!

Craft doesn't provide a template editor as part of the CP, so your only option is to edit or replace the Twig templates that live on-disk.

I strongly recommend heeding the advice you've seen, vis-a-vis working locally. Whenever possible, it's a good idea to keep a local copy of the site's files (checked in to Git or other source control)—that way, if you edit a template on the server and break something, it's easy to undo and copy an old version back.

Answered by August Miller on May 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP