From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: ox-hugo, 2 questions Date: Sat, 9 Jun 2018 23:24:41 -0400 Message-ID: References: <87sh5v4sw6.fsf@tsdye.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005f7afd056e412d21" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqyV-0004Az-37 for emacs-orgmode@gnu.org; Sat, 09 Jun 2018 23:25:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqyR-0000BP-JT for emacs-orgmode@gnu.org; Sat, 09 Jun 2018 23:25:03 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:45223) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqyR-0000Aq-7B for emacs-orgmode@gnu.org; Sat, 09 Jun 2018 23:24:59 -0400 Received: by mail-lf0-x233.google.com with SMTP id n3-v6so25586894lfe.12 for ; Sat, 09 Jun 2018 20:24:58 -0700 (PDT) In-Reply-To: <87sh5v4sw6.fsf@tsdye.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Thomas S. Dye" Cc: Org-mode --0000000000005f7afd056e412d21 Content-Type: text/plain; charset="UTF-8" Hello Tom. On Sat, Jun 9, 2018 at 4:43 PM Thomas S. Dye wrote: > Aloha all, > > 1) Is this the correct way to get an image in the homepage branch > bundle? > > I have this in the org file: > > * Homepage > :PROPERTIES: > :EXPORT_HUGO_SECTION: > :EXPORT_FILE_NAME: index > :END: > > [[/bldg-1-5-sequence-distance-1332+-small.png]] > I see a couple of things that are wrong there: 1. The branch bundles have _index.md file. index.md makes it a page bundle. You can see Table 1 here: https://scripter.co/hugo-leaf-and-branch-bundles/. 2. You mentioned homepage branch bundle, but I don't see the use of EXPORT_HUGO_BUNDLE. Using index.md instead of _index.md is a very common mistake. Reading the above link might help understand the difference more. Feel free to ask more questions about that on the ox-hugo Github issue manager itself as this gets out of the Org mode scope for this mailing list. This is the markdown export: > > +++ > title = "Homepage" > author = ["Thomas S. Dye"] > lastmod = 2018-06-09T09:32:43-10:00 > draft = false > +++ > > {{< figure src="/bldg-1-5-sequence-distance-1332+-small.png" >}} > > I don't see an image on the home page. Perhaps this is an issue > with the theme I'm using (material-docs)? > It's difficult to tell. Can you share a git repo with a minimal site (just the config.toml and the Org content files would do). I will try reproducing the issue locally using ox-hugo plus the ox-hugo test site theme: https://github.com/kaushalmodi/hugo-bare-min-theme. I have a "sandbox" site where you can see an example of _index. See for "_index" here: https://gitlab.com/kaushalmodi/hugo-sandbox/raw/master/content-org/sandbox.org. That example also happens to have an image on the home page, though I am inserting that image in the layout file itself using the .Resources Hugo method. Here is the outcome: https://hugo-sandbox.netlify.com/. > 2) Can I have links in figure captions? > > I have this in the org file: > > #+name: fig-12-sequence > #+caption: Stratigraphic DAG for the information on Figure > [[fig-12-section]]. > [[file:/fig-12-sequence.png][file:/fig-12-sequence-small.png]] > > This is the markdown export: > > {{< figure src="/fig-12-sequence-small.png" caption="Figure 2: > Stratigraphic DAG for the information on Figure [1](#org1658d1e)." > link="/fig-12-sequence.png" >}} > This is a known issue in Hugo. The default figure shortcode does not convert Markdown in figure captions to HTML: https://github.com/gohugoio/hugo/issues/4406, https://github.com/kaushalmodi/ox-hugo/issues/136. So I use my custom figure shortcode to fix this (and an other unrelated issue) for my own site: https://gitlab.com/kaushalmodi/hugo-theme-refined/blob/master/layouts/shortcodes/figure.html . Just putting this custom figure.html in your site's layouts/shortcodes/ directory (which will override the inbuilt figure shortcode) will fix this second issue. Hope this helps. For future, you can ask ox-hugo questions directly at https://github.com/kaushalmodi/ox-hugo/issues. I don't mind Hugo-related questions there too. But just so that you know the Hugo Discourse forum is pretty active too: https://discourse.gohugo.io/. Kaushal PS: My reply ended up containing a lot of links.. hope that doesn't overwhelm you, but instead helps resolve the issues. -- Kaushal Modi --0000000000005f7afd056e412d21 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Tom.

On Sat, Jun 9, 2018 at 4:43 PM Thomas S. Dye <tsd@tsdye.com> wrote:
Aloha all,

1) Is this the correct way to get an image in the homepage branch
bundle?

I have this in the org file:

* Homepage
=C2=A0 :PROPERTIES:
=C2=A0 :EXPORT_HUGO_SECTION:
=C2=A0 :EXPORT_FILE_NAME: index
=C2=A0 :END:

[[/bldg-1-5-sequence-distance-1332+-small.png]]

I see a couple of things that are wrong there:

1. The branch bundles have _index.md file. index.md makes it a page b= undle. You can see Table 1 here: https://scripter.co/hugo-leaf-and-branch-bundles/.<= /div>
2. You mentioned homepage branch bundle, but I don't see the = use of EXPORT_HUGO_BUNDLE.

Using index.md instead = of _index.md is a very common mistake. Reading the above link might help un= derstand the difference more. Feel free to ask more questions about that on= the ox-hugo Github issue manager itself as this gets out of the Org mode s= cope for this mailing list.

This is the markdown export:

+++
title =3D "Homepage"
author =3D ["Thomas S. Dye"]
lastmod =3D 2018-06-09T09:32:43-10:00
draft =3D false
+++

{{< figure src=3D"/bldg-1-5-sequence-distance-1332+-small.png"= >}}

I don't see an image on the home page.=C2=A0 Perhaps this is an issue <= br> with the theme I'm using (material-docs)?

It's difficult to tell. Can you share a git repo with a minimal = site (just the config.toml and the Org content files would do). I will try = reproducing the issue locally using ox-hugo plus the ox-hugo test site them= e: https://g= ithub.com/kaushalmodi/hugo-bare-min-theme.

I have a "sandbox" site where you can see an example of _index.= See for "_index" here: https://gitlab.com/kausha= lmodi/hugo-sandbox/raw/master/content-org/sandbox.org. That example also happens to have an image on the home page, though I=20 am inserting that image in the layout file itself using the .Resources=20 Hugo method.

Here is the outcome: https://hugo-sandbox.netlify.com/.
<= div>
=C2=A0
2) Can I have links in figure captions?

I have this in the org file:

=C2=A0#+name: fig-12-sequence
=C2=A0#+caption: Stratigraphic DAG for the information on Figure
=C2=A0[[fig-12-section]].
=C2=A0[[file:/fig-12-sequence.png][file:/fig-12-sequence-small.png]]

This is the markdown export:

{{< figure src=3D"/fig-12-sequence-small.png" caption=3D"= Figure 2:
Stratigraphic DAG for the information on Figure [1](#org1658d1e)." link=3D"/fig-12-sequence.png" >}}

This is a known issue in Hugo. The default figure shortcode does no= t convert Markdown in figure captions to HTML: https://github.com/gohugoio/hugo/issues/4406, https://g= ithub.com/kaushalmodi/ox-hugo/issues/136.

So I= use my custom figure shortcode to fix this (and an other unrelated issue) = for my own site: https://gitlab.com/kaushalmo= di/hugo-theme-refined/blob/master/layouts/shortcodes/figure.html.
=

Just putting this custom figure.html in your site's= layouts/shortcodes/ directory (which will override the inbuilt figure shor= tcode) will fix this second issue.

Hope this helps= . For future, you can ask ox-hugo questions directly at https://github.com/kaushalmodi/ox-hu= go/issues.

I don't mind Hugo-related quest= ions there too. But just so that you know the Hugo Discourse forum is prett= y active too: https://discourse.go= hugo.io/.

Kaushal

PS:= My reply ended up containing a lot of links.. hope that doesn't overwh= elm you, but instead helps resolve the issues.

-= -

Kaushal Modi

--0000000000005f7afd056e412d21--