# Notícias com imagem na home

Snippet para criar notícias com imagens para serem exibidas na home.

{% tabs %}
{% tab title="HTML" %}

```html
{#
  # Noticias com imagem
#}

{% for pages in pages.custom %}
    {% if pages.info == "noticias" %}
    <div class="section-notices">
        <h2 class="title-section">
            <a href="/loja/busca_noticias.php">
                <span>Confira Nossas Notícias</span>
            </a>
        </h2>
        <div class="noticias-content">
        </div>
    </div>
    {% endif %}
{% endfor %} 
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
jQuery(function(){
  setTimeout(function() {
    document.getElementsByTagName("html")[0].getAttribute("data-store");
    var s = "busca_noticias.php?loja=" + document.getElementsByTagName("html")[0].getAttribute("data-store") +'&'+ document.getElementsByTagName("html")[0].getAttribute("data-files")
      , e = jQuery(".noticias-content");
    jQuery.ajax({
        url: s,
        type: "GET",
        dataType: "html",
        success: function(s) {
            var t = s.replace(/src/g, 'src');
            e.html('<div class="noticias">' + jQuery(t).find(".noticias").html() + "</div>"),
            e.find("li").wrapInner('<div class="box-noticia"></div>').find('img').attr('width', '400').attr('height', '400'),
            e.find(".noticias li:nth-child(n+5)").remove(),
            e.find('.noticias li').length ? '' : jQuery('.section-notices').remove();
        }
    })
  }, 400);
})
```

{% endtab %}
{% endtabs %}

### Como usar <a href="#como-usar" id="como-usar"></a>

Copie o código ***HTML*** acima e insira no arquivo `home.html` onde desejar.

Para o arquivo ***JavaScript*** crie um novo arquivo na pasta ***JS*** e faça sua chamada conforme exemplo:

```javascript
<script type="text/javascript" src="{{ asset('js/load-news.js') }}"></script>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://partners.tray.com.br/themes/construindo-seu-template/referencias/componentes/noticias-com-imagem-na-home.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
