emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ox-hugo, 2 questions
@ 2018-06-09 20:16 Thomas S. Dye
  2018-06-10  3:24 ` Kaushal Modi
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2018-06-09 20:16 UTC (permalink / raw)
  To: Org-mode

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]]

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)?

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" >}}

All the best,
Tom

--
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ox-hugo, 2 questions
  2018-06-09 20:16 ox-hugo, 2 questions Thomas S. Dye
@ 2018-06-10  3:24 ` Kaushal Modi
  2018-06-10  5:14   ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Kaushal Modi @ 2018-06-10  3:24 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 3355 bytes --]

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
>   :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

[-- Attachment #2: Type: text/html, Size: 5201 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ox-hugo, 2 questions
  2018-06-10  3:24 ` Kaushal Modi
@ 2018-06-10  5:14   ` Thomas S. Dye
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas S. Dye @ 2018-06-10  5:14 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Org-mode, Thomas S. Dye

Aloha Kaushal,

Kaushal Modi writes:
>
> 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/.

Many thanks for this kind offer.  Will do, if I can't figure it 
out.

> 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.

Yes, it works like magic!

> 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/.

OK, will do.

All the best,
Tom

--
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-10  5:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-09 20:16 ox-hugo, 2 questions Thomas S. Dye
2018-06-10  3:24 ` Kaushal Modi
2018-06-10  5:14   ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).