I am migrating from Octopress, and some of my pages have a blockquote tag, like this
{% blockquote %}
my quote here
{% endblockquote %}
any idea how to port that to hugo?
I am migrating from Octopress, and some of my pages have a blockquote tag, like this
{% blockquote %}
my quote here
{% endblockquote %}
any idea how to port that to hugo?
Either use the blockquote syntax in Markdown:
> my quote here
Or if you need some special formatting, see
Thanks @bep. Will check it out. Are you aware of anybody that has already solved this problem? Otherwise I can take a stab at it.
As I said, this is built into markdown, So this isn’t a problem. I use it all the time.
If you are looking for the basic functionality of the blockquote
plugin which is just having a quote, bep’s answer works. To see it in action you can check my license page, the MIT license is a block quote using >
.
If you are looking at using its other functionalities like using links, link titles and author then you have to create a shortcode. I can create one if you are interested.
Thanks @parsiya.
I think I nailed, this way.
<blockquote>
<p>{{ .Inner }}</p>
<div class="citation">
<strong>{{ .Get "name"}}</strong>
{{if .Get "link"}}
<a href="{{.Get "link"}}">source</a>
{{ end }}
</div>
</blockquote>
Nice. I think you got it. However be sure to grab the source
variable from the tag.
I wish I had seen it last night, I went ahead and created a blockquote
shortcode anyways. You can see it here. It’s messy mostly because of the trying to imitate the actual blockquote by cutting the link at 32 characters and then at the last forward slash.
Here’s a picture of the output for the tests I created.
Very cool @parsiya. It’s a bit messy but it’s a great start. Unfortunately I can’t devote time on this but it’d be great for me to show the domain (e.g. blog.com) instead of source.
So this won’t work?
Quote with author and link
{{< blockquote author="Author4" link="https://www.google.com" >}}
This is a quote from Author4 and links to https://www.google.com.
{{< /blockquote >}}
It will show Google.com
at the bottom with a link.
@parsiya It will work but when I quote blogs with long URLs it might scramble the layout, especially on mobile. So at the moment I’ll go with source.