Page banner setup

From ProxiBlue/claude-skills · View interactive version

Page banner setup is an AI agent skill from the GitHub repository ProxiBlue/claude-skills. Guide Claude through setting up page titles with or without full-width banner backgrounds in Magento 2 / Hyvä Themes projects. This skill covers the two different title/banner layouts used in the NTO

How to use this skill

Skill file

Page Banner Setup Skill

Purpose

Guide Claude through setting up page titles with or without full-width banner backgrounds in Magento 2 / Hyvä Themes projects. This skill covers the two different title/banner layouts used in the NTO

disable-model-invocation: true project.

When to Use This Skill

Template Options

1. Full-Width Banner Template (`title_banner.phtml`)

Use when:

Features:

Template Location:

app/design/frontend/Uptactics/nto/Magento_Theme/templates/html/title_banner.phtml

2. Standard Title Template (`title.phtml`)

Use when:

Features:

Template Location:

app/design/frontend/Uptactics/nto/Magento_Theme/templates/html/title.phtml

Implementation Pattern

Step 1: Remove Default Title Block

Always start by removing the default page.main.title block:

<referenceBlock name="page.main.title" remove="true"/>

Step 2: Add Custom Title Block

Option A: Full-Width Banner (Recommended for Custom Pages)

Add to content.top container for full-width effect:

<referenceContainer name="content.top">
    <block class="Magento\Theme\Block\Html\Title"
           name="custom.page.title"
           template="Magento_Theme::html/title_banner.phtml"
           before="-">
        <arguments>
            <argument name="css_class" xsi:type="string">text-2xl sm:text-3xl lg:text-4xl text-white uppercase</argument>
            <argument name="banner_image" xsi:type="string">Uptactics_ModuleName::images/banner-image.svg</argument>
            <!-- Optional subtitle -->
            <argument name="subtitle" xsi:type="string" translate="true">Optional descriptive subtitle</argument>
            <argument name="subtitle_css_class" xsi:type="string">text-lg text-white mt-2</argument>
        </arguments>
    </block>
</referenceContainer>

Arguments:

Option B: Standard Title (For Simple Pages)

Add to content container:

<referenceContainer name="content">
    <block class="Magento\Theme\Block\Html\Title"
           name="custom.page.title"
           template="Magento_Theme::html/title.phtml"
           before="-">
        <arguments>
            <argument name="css_class" xsi:type="string">text-3xl font-bold</argument>
        </arguments>
    </block>
</referenceContainer>

Common Banner Image Paths

Module-Based Images

Store banner images in your custom module's view folder:

app/code/Uptactics/ModuleName/view/frontend/web/images/banner.svg

Reference in layout XML:

<argument name="banner_image" xsi:type="string">Uptactics_ModuleName::images/banner.svg</argument>

Theme-Based Images

Store banner images in theme:

app/design/frontend/Uptactics/nto/web/images/banner.svg

Reference in layout XML:

<argument name="banner_image" xsi:type="string">images/banner.svg</argument>

CSS Class Recommendations

Title Classes (Responsive Sizing)

<!-- Large hero titles -->
<argument name="css_class" xsi:type="string">text-2xl sm:text-3xl lg:text-4xl text-white uppercase</argument>

<!-- Medium titles -->
<argument name="css_class" xsi:type="string">text-xl sm:text-2xl lg:text-3xl text-white uppercase</argument>

<!-- Small titles -->
<argument name="css_class" xsi:type="string">text-lg sm:text-xl lg:text-2xl text-white uppercase</argument>

Color Options

Real-World Example: RCC Calculator Page

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <!-- Remove default title -->
        <referenceBlock name="page.main.title" remove="true"/>

        <!-- Add custom title with banner -->
        <referenceContainer name="content.top">
            <block class="Magento\Theme\Block\Html\Title"
                   name="calculator.page.title"
                   template="Magento_Theme::html/title_banner.phtml"
                   before="-">
                <arguments>
                    <argument name="css_class" xsi:type="string">text-2xl sm:text-3xl lg:text-4xl text-white uppercase</argument>
                    <argument name="banner_image" xsi:type="string">Uptactics_Rcc::images/rcc-banner.svg</argument>
                </arguments>
            </block>
        </referenceContainer>

        <!-- Rest of page content -->
        <referenceContainer name="content">
            <!-- Calculator widget or content blocks -->
        </referenceContainer>
    </body>
</page>

Decision Tree

Do you need a banner image?
├─ YES → Use title_banner.phtml
│   ├─ Place in content.top container
│   ├─ Provide banner_image argument
│   └─ Use white text for visibility
│
└─ NO → Use title.phtml
    ├─ Place in content container
    ├─ Use standard title styling
    └─ No banner_image argument needed

Technical Details

title_banner.phtml Behavior

title.phtml Behavior

Common Mistakes to Avoid

  1. Wrong container placement
  1. Missing banner_image argument
  1. Incorrect image path format
  1. Not removing default title

Troubleshooting

Banner not full-width

Banner image not showing

Title not styled correctly

Cache Management

After making layout changes:

bin/magento cache:flush layout block_html full_page

After adding/changing banner images:

rm -rf pub/static/frontend/Uptactics/nto/*
bin/magento setup:static-content:deploy -f

Related Files

Key Takeaways

  1. Use title_banner.phtml for full-width banners with centered titles
  2. Use title.phtml for simple page titles without banners
  3. Always place full-width banners in content.top container
  4. Always remove default page.main.title block first
  5. Provide responsive CSS classes for title sizing
  6. Banner images should be in SVG or optimized image format
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.