Shopify / Shopify/liquid

Is there a way to make the HTML format exactly as I specify in the template

Open
#1,280 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Question
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

I have looked at most of #215 #214 #194 #171 #162 and #216

Here is what I want to do:

In a template file I have this:

<html lang="en-US">
    <head>
        {% include head.html %}
    </head>
</html>

I like this format of indentation and I want the contents of head.html to be similarly indented so the rendered HTML looks like:
Screenshot from 2020-08-22 14-39-48

In order to achieve this my head.html has to look like:

<title>{{ site.title }}</title>
        <meta name="description" content="{{ site.description }}">
        <meta name="keywords" content="{{ site.keywords }}">
        <meta name="author" content="{{ site.author }}">

Presumably with more and more indentation for every line after the first line as the the placement of {% include head.html %} gets indented more and more.

I have tried using {%- and read this

Is there an easy way to accomplish what I want? I sort of follow why the first line in head.html has to be indented differently but this has created a pretty complicated process to get the final HTML rendered as I want.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the referenced issues (#215, #214, #194, #171, #162, and #216) and the Liquid whitespace documentation linked in the report. The issue names no implementation file or test; work would need a defined approach for preserving indentation in included HTML and a test or documented behavior showing the rendered output matches the template structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, ruby
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.