Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Calling a link in twig from MD file

Started by Duc 9 years ago · 1 replies · 723 views
9 years ago

I would like to call a link in a twig from MD file.
This link is a 'buy it' button for snipcart.

TWIG
<a href="#"
    class="button primary snipcart-add-item"
    data-item-id="{{ page.header.product_id }}"
    data-item-name="{{ page.header.title }}"
    data-item-price="{{ page.header.price }}"
    data-item-url="{{ page.url }}"
    {% spaceless %}
    {% if cart_img %}
    data-item-image="{{ cart_img.cropResize(50,50).url }}"
    {% endif %}
    {% endspaceless %} >
<i class="fa fa-shopping-cart"></i> Add to Cart
</a>

In the MD file I would to wrap this link as such.

TXT
[buy it](/link)
9 years ago

Maybe you can do that with the shortcode plugin?

Suggested topics

Topic Participants Replies Views Activity
Support · by complanar, 6 days ago
6 139 14 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 50 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago