themefisher / airspace-hugo

Airspace Hugo theme for multipurpose use, like Portfolio, Blog, Business.
https://gethugothemes.com/products/airspace/?utm_source=airspace_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
351 stars 508 forks source link

allow for shortcodes in content files? #77

Closed dklinges9 closed 4 years ago

dklinges9 commented 4 years ago

Hi team,

I'm only modestly experienced with YAML and hugo sites, so apologies if this issue is unclear/not endemic to the theme/I'm missing something fundamental about using shortcodes.

I tried adding a shortcode (layouts/shortcodes/myshortcode.html) to one of the markdown files (content/english/faq/_index.md), and it appears that the content of the shortcode itself is passed into the content file, rather than rendering the shortcode.

I'm pulling from a hugo tutorial for a simple one-tag shortcode.

shortcode.html content:

<p style =“color:{{.Get `color`}}”>this is the framework text</p>

faq/_index.md content:

---
title: "Frequently Asked Questions"
description: "this is meta description"
subtitle : "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi, repudiandae."
date: 2019-12-23T13:05:29+06:00
draft: false
bg_image: "images/featue-bg.jpg"
---

### Welcome to Airspace!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia ullam sint quas pariatur ipsam nemo
repellendus suscipit quod accusantium numquam tempora assumenda sequi, velit voluptatem soluta voluptatibus
nesciunt ducimus iure. Excepturi voluptatum ullam tenetur perspiciatis alias delectus beatae voluptatibus
magni facere aspernatur, qui, quas nesciunt blanditiis assumenda a expedita accusantium quos consectetur neque
nemo.

{{< myshortcode color="blue">}}

which renders as such:

Screen Shot 2020-04-05 at 9 32 35 AM

Ultimately I hope to be embedding youtube videos or other pages into the content files, which I've been able to do using other Hugo themes but not here....

Thanks!

somratpro commented 4 years ago

hey there, you had a simple mistake. please replace your shortcode with this <p style="color:{{.Getcolor}}">this is the framework text</p>

somratpro commented 4 years ago

Did it solve your issue? I am going to close this issue, if you face any more issues, don't hesitate to reopen it.

dklinges9 commented 4 years ago

Apologies for the late reply (my website dev work is sporadic)– this didn't seem to change anything– I pasted your suggestion into the short code, and did some further messing around. What exactly was different between my short code and your edit?

my version:

<p style =“color:{{.Get `color`}}”>this is the framework text</p>

your version:

<p style="color:{{.Get color}}">this is the framework text</p>

you took away the space after "style" and didn't have "color" in single quotes (but I think that part was the markdown rendering of the comment)?

somratpro commented 4 years ago

no, just look at the quotation, you entered the wrong quotation. it should "" , not “”