Produccion 1
This commit is contained in:
+280
-48
@@ -1,68 +1,300 @@
|
||||
{% comment %}
|
||||
This section is used in the article template to render the article page, which
|
||||
displays the full content of the blog post and can optionally include a
|
||||
comments section for customers (not shown in this example).
|
||||
{% liquid
|
||||
assign share_url = shop.url | append: article.url
|
||||
assign share_url_encoded = share_url | url_encode
|
||||
assign share_title = article.title | url_encode
|
||||
assign published = article.published_at | date: '%B %d, %Y'
|
||||
|
||||
https://shopify.dev/docs/storefronts/themes/architecture/templates/article
|
||||
{% endcomment %}
|
||||
assign share_image = ''
|
||||
if article.image != blank
|
||||
assign share_image = article.image | image_url: width: 1200
|
||||
unless share_image contains 'https:'
|
||||
assign share_image = share_image | prepend: 'https:'
|
||||
endunless
|
||||
assign share_image = share_image | url_encode
|
||||
endif
|
||||
%}
|
||||
|
||||
{% if article.image %}
|
||||
{{ article.image | image_url: width: 1000 | image_tag }}
|
||||
{% endif %}
|
||||
<div class="article full-width bg-white pb-9 font-sans text-[#212326]">
|
||||
<article>
|
||||
{% if article.image != blank %}
|
||||
<div class="mx-auto mt-[45px] w-full max-w-[1170px] px-5 md:mt-8">
|
||||
{{
|
||||
article.image
|
||||
| image_url: width: 2000
|
||||
| image_tag:
|
||||
loading: 'eager',
|
||||
widths: '600, 900, 1200, 1600, 2000',
|
||||
sizes: '(max-width: 1200px) 100vw, 1170px',
|
||||
alt: article.image.alt | default: article.title,
|
||||
class: 'h-auto w-full bg-[#f3f3f3]'
|
||||
}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1>{{ article.title }}</h1>
|
||||
<div class="mx-auto w-full max-w-[1170px] px-5">
|
||||
<nav
|
||||
class="mt-7 text-center text-[9px] uppercase leading-none tracking-[1.17px] text-[#212326]/75"
|
||||
aria-label="{{ 'blog.breadcrumb' | t }}"
|
||||
>
|
||||
<a class="text-inherit no-underline hover:underline" href="{{ routes.root_url }}">
|
||||
{{- 'blog.home' | t -}}
|
||||
</a>
|
||||
<span class="px-1" aria-hidden="true">/</span>
|
||||
<a class="text-inherit no-underline hover:underline" href="{{ blog.url }}">
|
||||
{{- blog.title | escape -}}
|
||||
</a>
|
||||
<span class="px-1" aria-hidden="true">/</span>
|
||||
</nav>
|
||||
|
||||
{% assign date = article.published_at | time_tag: format: 'date' %}
|
||||
<p>{{ 'blog.article_metadata_html' | t: date: date, author: article.author }}</p>
|
||||
<header class="mb-[45px] mt-7 text-center">
|
||||
<h1 class="relative m-0 mb-[27px] pb-[18px] text-balance text-[64px] font-light leading-[1.27] tracking-[0.6px] text-[#1a1b18] after:absolute after:bottom-0 after:left-1/2 after:h-[3px] after:w-[90px] after:-translate-x-1/2 after:bg-[#1a1b18] after:content-[''] lg:text-[48px] md:text-[34px] md:leading-[1.2]">
|
||||
{{ article.title | escape }}
|
||||
</h1>
|
||||
<time
|
||||
class="text-[18px] font-normal leading-none text-[#212326]/75"
|
||||
datetime="{{ article.published_at | date: '%Y-%m-%d' }}"
|
||||
>
|
||||
{{- published -}}
|
||||
</time>
|
||||
</header>
|
||||
|
||||
{{ article.content }}
|
||||
<div class="article-rte">
|
||||
{{ article.content }}
|
||||
</div>
|
||||
|
||||
{% if blog.comments_enabled? %}
|
||||
<h2>{{ 'blog.article_comments' | t }}</h2>
|
||||
{% if blog.comments_enabled? %}
|
||||
<div id="comments" class="mt-12 border-t border-solid border-[#d2d5d9] pt-10">
|
||||
<h2 class="m-0 text-[35px] font-light leading-[1.27] tracking-[0.6px] text-[#1a1b18] md:text-[26px]">
|
||||
{{ 'blog.article_comments' | t }}
|
||||
</h2>
|
||||
|
||||
<div id="comments">
|
||||
{% paginate article.comments by 10 %}
|
||||
{% for comment in article.comments %}
|
||||
<div>
|
||||
<p>{{ comment.author }}</p>
|
||||
<p>
|
||||
{{- comment.created_at | time_tag: format: 'date' -}}
|
||||
</p>
|
||||
<p>{{ comment.content }}</p>
|
||||
{% paginate article.comments by 10 %}
|
||||
<div class="mt-6 flex flex-col gap-6">
|
||||
{% for comment in article.comments %}
|
||||
<div class="border-b border-solid border-[#d2d5d9] pb-6">
|
||||
<p class="m-0 text-[14.4px] font-medium text-[#1a1b18]">{{ comment.author | escape }}</p>
|
||||
<p class="m-0 mt-1 text-[12.6px] text-[#212326]/75">
|
||||
{{ comment.created_at | date: '%B %d, %Y' }}
|
||||
</p>
|
||||
<div class="mt-3 text-[14.4px] leading-[1.89]">{{ comment.content }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if paginate.pages > 1 %}
|
||||
<div class="mt-6 text-[14.4px]">
|
||||
{{ paginate | default_pagination: anchor: 'comments' }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endpaginate %}
|
||||
|
||||
{% form 'new_comment', article %}
|
||||
<h2 class="mb-4 mt-10 text-[28px] font-light leading-[1.27] tracking-[0.6px] text-[#1a1b18]">
|
||||
{{ 'blog.comment_form_title' | t }}
|
||||
</h2>
|
||||
|
||||
{% if form.posted_successfully? %}
|
||||
<p class="m-0 mb-4 text-[14.4px]" role="status">{{ 'blog.comment_success' | t }}</p>
|
||||
{% endif %}
|
||||
|
||||
{{ form.errors | default_errors }}
|
||||
|
||||
<div class="grid gap-4">
|
||||
<div>
|
||||
<label class="text-[12.6px] text-[#1a1b18]" for="author">{{ 'blog.comment_form_name' | t }}</label>
|
||||
<input
|
||||
class="mt-2 w-full rounded-lg border border-solid border-[#d2d5d9] bg-white px-4 py-3 text-[14.4px] text-[#1a1b18] outline-none focus:border-[#1a1b18]"
|
||||
type="text"
|
||||
name="comment[author]"
|
||||
id="author"
|
||||
value="{{ form.author }}"
|
||||
required
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[12.6px] text-[#1a1b18]" for="email">{{ 'blog.comment_form_email' | t }}</label>
|
||||
<input
|
||||
class="mt-2 w-full rounded-lg border border-solid border-[#d2d5d9] bg-white px-4 py-3 text-[14.4px] text-[#1a1b18] outline-none focus:border-[#1a1b18]"
|
||||
type="email"
|
||||
name="comment[email]"
|
||||
id="email"
|
||||
value="{{ form.email }}"
|
||||
required
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[12.6px] text-[#1a1b18]" for="body">{{ 'blog.comment_form_body' | t }}</label>
|
||||
<textarea
|
||||
class="mt-2 min-h-[140px] w-full rounded-lg border border-solid border-[#d2d5d9] bg-white px-4 py-3 text-[14.4px] text-[#1a1b18] outline-none focus:border-[#1a1b18]"
|
||||
name="comment[body]"
|
||||
id="body"
|
||||
required
|
||||
>{{ form.body }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
class="inline-flex cursor-pointer items-center justify-center rounded-full border border-solid border-brand-mint bg-brand-mint px-[27px] py-[9px] text-[12px] font-medium uppercase leading-none text-[#212326]"
|
||||
type="submit"
|
||||
>
|
||||
{{ 'blog.comment_form_submit' | t }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endform %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{{ paginate | default_pagination: anchor: 'comments' }}
|
||||
{% endpaginate %}
|
||||
</div>
|
||||
{% if section.settings.show_share %}
|
||||
<div class="mt-7 flex flex-wrap items-center gap-x-4 gap-y-2 text-[12.6px] text-[#1a1b18]">
|
||||
<span class="uppercase tracking-[0.08em]">{{ 'blog.share' | t }}</span>
|
||||
<a
|
||||
class="text-inherit no-underline hover:underline"
|
||||
href="https://www.facebook.com/sharer.php?u={{ share_url_encoded }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Facebook
|
||||
</a>
|
||||
<a
|
||||
class="text-inherit no-underline hover:underline"
|
||||
href="https://twitter.com/intent/tweet?url={{ share_url_encoded }}&text={{ share_title }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
X
|
||||
</a>
|
||||
{% if share_image != blank %}
|
||||
<a
|
||||
class="text-inherit no-underline hover:underline"
|
||||
href="https://pinterest.com/pin/create/button/?url={{ share_url_encoded }}&media={{ share_image }}&description={{ share_title }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Pinterest
|
||||
</a>
|
||||
{% endif %}
|
||||
<a
|
||||
class="text-inherit no-underline hover:underline"
|
||||
href="https://wa.me/?text={{ share_title }}%20{{ share_url_encoded }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
WhatsApp
|
||||
</a>
|
||||
<button
|
||||
class="cursor-pointer border-0 bg-transparent p-0 text-[12.6px] text-inherit underline-offset-2 hover:underline"
|
||||
type="button"
|
||||
data-copy-link
|
||||
data-url="{{ share_url | escape }}"
|
||||
data-copied="{{ 'blog.copied' | t | escape }}"
|
||||
>
|
||||
<span data-copy-label>{{ 'blog.copy_link' | t }}</span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% form 'new_comment', article %}
|
||||
<h2>{{ 'blog.comment_form_title' | t }}</h2>
|
||||
|
||||
{{ form.errors | default_errors }}
|
||||
|
||||
<div>
|
||||
<label for="author">{{ 'blog.comment_form_name' | t }}</label>
|
||||
<input type="text" name="comment[author]" id="author" value="{{ form.author }}" required>
|
||||
<div class="mt-10 text-center">
|
||||
<a
|
||||
class="inline-flex items-center gap-2 rounded-full px-4 py-2 text-[11px] font-medium uppercase tracking-[0.08em] text-[#1a1b18] no-underline hover:underline"
|
||||
href="{{ blog.url }}"
|
||||
>
|
||||
<svg class="size-3.5" viewBox="0 0 14 10" fill="none" aria-hidden="true">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M5.463.808a.5.5 0 0 0-.817-.162l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.207 5.5H13a.5.5 0 0 0 0-1H2.207L5.354 1.354a.5.5 0 0 0 .109-.546z"/>
|
||||
</svg>
|
||||
{{ 'blog.back' | t: blog: blog.title }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="email">{{ 'blog.comment_form_email' | t }}</label>
|
||||
<input type="email" name="comment[email]" id="email" value="{{ form.email }}" required>
|
||||
</div>
|
||||
{% if blog.previous_article or blog.next_article %}
|
||||
<ul class="mx-auto mt-[45px] grid w-full max-w-[1440px] list-none grid-cols-2 gap-[27px] border border-solid border-[#d2d5d9] px-[45px] py-[45px] md:grid-cols-1 md:px-5 md:py-8">
|
||||
<li>
|
||||
{% if blog.previous_article %}
|
||||
<a class="inline-flex items-center gap-3 text-[#1a1b18] no-underline hover:underline" href="{{ blog.previous_article.url }}">
|
||||
<svg class="size-3.5 shrink-0" viewBox="0 0 14 10" fill="none" aria-hidden="true">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M5.463.808a.5.5 0 0 0-.817-.162l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.207 5.5H13a.5.5 0 0 0 0-1H2.207L5.354 1.354a.5.5 0 0 0 .109-.546z"/>
|
||||
</svg>
|
||||
<span class="text-[22px] font-light leading-[1.27] tracking-[0.6px]">
|
||||
{{ blog.previous_article.title | escape }}
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="md:text-left text-right">
|
||||
{% if blog.next_article %}
|
||||
<a class="inline-flex items-center justify-end gap-3 text-[#1a1b18] no-underline hover:underline md:justify-start" href="{{ blog.next_article.url }}">
|
||||
<span class="text-[22px] font-light leading-[1.27] tracking-[0.6px]">
|
||||
{{ blog.next_article.title | escape }}
|
||||
</span>
|
||||
<svg class="size-3.5 shrink-0" viewBox="0 0 14 10" fill="none" aria-hidden="true">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M8.537.808a.5.5 0 0 1 .817-.162l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 1 1-.708-.708L11.793 5.5H1a.5.5 0 0 1 0-1h10.793L8.646 1.354a.5.5 0 0 1-.109-.546z"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</article>
|
||||
|
||||
<div>
|
||||
<label for="body">{{ 'blog.comment_form_body' | t }}</label>
|
||||
<textarea name="comment[body]" id="body" required>{{ form.body }}</textarea>
|
||||
</div>
|
||||
{% if section.settings.show_related and blog.articles.size > 1 %}
|
||||
<section class="mx-auto mt-9 w-full max-w-[1440px] px-[45px] pb-[72px] md:px-5 md:pb-12" aria-labelledby="RelatedArticles-{{ section.id }}">
|
||||
<div class="mb-[27px] flex items-center justify-between gap-4 md:flex-col md:items-start">
|
||||
<h2 id="RelatedArticles-{{ section.id }}" class="m-0 text-[35px] font-light leading-[1.27] tracking-[0.6px] text-[#1a1b18] md:text-[26px]">
|
||||
{{ 'blog.related' | t }}
|
||||
</h2>
|
||||
<a
|
||||
class="inline-flex items-center justify-center rounded-full border border-solid border-brand-mint bg-brand-mint px-[27px] py-[9px] text-[12px] font-medium uppercase leading-none text-[#212326] no-underline"
|
||||
href="{{ blog.url }}"
|
||||
>
|
||||
{{ 'blog.view_all' | t }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<input type="submit" value="{{ 'blog.comment_form_submit' | t }}">
|
||||
{% endform %}
|
||||
{% endif %}
|
||||
<div class="grid grid-cols-3 gap-x-[27px] gap-y-10 lg:grid-cols-2 md:grid-cols-1">
|
||||
{% for related in blog.articles limit: 3 %}
|
||||
{% render 'blog-card', article: related, heading_tag: 'h3' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% javascript %}
|
||||
document.querySelectorAll('[data-copy-link]').forEach((button) => {
|
||||
if (button.getAttribute('data-copy-bound') === 'true') return;
|
||||
button.setAttribute('data-copy-bound', 'true');
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
const url = button.getAttribute('data-url');
|
||||
const label = button.querySelector('[data-copy-label]');
|
||||
if (!url || !navigator.clipboard || !label) return;
|
||||
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
const original = label.textContent;
|
||||
label.textContent = button.getAttribute('data-copied') || original;
|
||||
window.setTimeout(() => {
|
||||
label.textContent = original;
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
});
|
||||
{% endjavascript %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
"name": "t:general.article",
|
||||
"settings": []
|
||||
"settings": [
|
||||
{
|
||||
"type": "checkbox",
|
||||
"id": "show_share",
|
||||
"label": "t:blog_section.show_share",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"type": "checkbox",
|
||||
"id": "show_related",
|
||||
"label": "t:blog_section.show_related",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
{% endschema %}
|
||||
|
||||
Reference in New Issue
Block a user