Adding non-HTML files to your site with alternative file extensions

Sometimes you may be asked by a third party to add a file to your site to prove ownership, or to provide helpful metadata to 3rd parties. This article explains how to use CLI to create a page with a file extension like .txt

Written By Matt Jones

Last updated 1 day ago

Pre-requisites

This feature requires Siteglide-CLI to be set up and ready to use for your site, see:
Introduction to the Command Line Interface (CLI)

Learn how to install the CLI: Quickstart: CLI

Set CLI up for your site: CLI - Site Setup

Learn the basic pull and sync commands: CLI Command Reference

Steps

In these steps, we will create a file called security.txt on the root of the site:

  1. First, use CLI to pull the current file structure of the site into a local folder on your machine.

  2. In your file structure, identify the marketplace_builder/views/pages folder.

  3. To create your new file on the root of the site, create a file in the pages folder, where the filename is the name of the file you need + the extension you need + an additional extension of .liquid If you need any additional folders, you can create them first. For example, if you need a file on the root called security.txt, you should create a file at ./marketplace_builder/views/pages/security.txt.liquid. If you need a file at /example/example.csv you should create a file at marketplace_builder/views/pages/example/example.csv.liquid

  4. Normally, if you’re not writing an HTML file, you may wish to hide the page template completely along with any boilerplate HTML it includes. To do this, set the yaml in the top of the page to have an empty string “layout” (layout is platformOS’s name for template):

Example
--- layout: '' ---
  1. Finally add the intended contents of the file below the 2nd yaml document marker “—-” (triple dash).

Example
--- layout: '' --- File contents here!
  1. Sync your file to create it on the file-system.