.Kind (page): .Type (posts) / .Layout ()
Bundle: n/a (regular page)
[ categories | tags | search ]
ox-hugo Test Site

This is the test site for the ox-hugo package for Emacs/Org-mode.

It is updated automatically after each commit to the ox-hugo repo. It was last updated on May 27, 2022 19:44 UTC.

This page was created/modified in commit 71cb5f2 "fix: Remove the blank line inserted between code blocks and captions" on 2022-05-27.
Markdown source of this page

Links to source blocks

tags: links internal-links src-block


Test for internal links to source block references.


From (org) Internal Links,

If no dedicated target exists, the link will then try to match the exact name of an element within the buffer. Naming is done with the ‘#+name’ keyword, which has to be put in the line before the element it refers to, as in the following example

#+name: My Target
| a  | table      |
| of | four cells |

Also, when targeting a #+name keyword, #+caption keyword is mandatory in order to get proper numbering for source blocks, images and tables.

So the below code block:

#+caption: Hello
#+name: code__hello
#+begin_src emacs-lisp
(message "Hello")
*Here we refer to [[code__helloagain]].*

#+include: "../misc/common.org::#lorem-ipsum" :only-contents t

#+caption: Hello Again
#+name: code__helloagain
#+begin_src emacs-lisp
(message "Hello again")
*Here we refer to [[code__hello]].*

will output below (lorem-ipsum added to increase page content so that the link jump is evident):

(message "Hello")
Code Snippet 1: Hello

Here we refer to 2.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque et quam metus. Etiam in iaculis mi, sit amet pretium magna. Donec ut dui mi. Maecenas pharetra sapien nunc, ut mollis enim aliquam quis. Nam at ultricies metus. Nulla tempor augue in vestibulum tristique. Phasellus volutpat pharetra metus quis suscipit. Morbi maximus sem dolor, id accumsan ipsum commodo non.

Fusce quam ligula, gravida ac dui venenatis, bibendum commodo lorem. Duis id elit turpis. Integer sed diam nibh. Donec tempus lacinia odio, a laoreet velit dictum id. Suspendisse efficitur euismod purus et porttitor. Aliquam sit amet tellus mauris. Mauris semper dignissim nibh, faucibus vestibulum purus varius quis. Suspendisse potenti. Cras at ligula sit amet nunc vehicula condimentum quis nec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec iaculis, neque sit amet maximus rhoncus, nisl tortor convallis ante, ut mollis purus augue ut justo. Praesent felis urna, volutpat sit amet posuere dictum, luctus quis nibh. Proin et tristique ipsum, in aliquam ante.

Aenean eget ex mauris. Cras ut tempor quam. Curabitur eget nulla laoreet, bibendum neque porta, tempus nulla. Ut tellus nisi, semper eu ligula pretium, aliquam accumsan dolor. Nunc fermentum cursus arcu eu suscipit. Nam dolor tellus, efficitur sed condimentum at, fringilla eget nisi. Nulla luctus metus felis. Suspendisse potenti. Cras lacinia orci nec dui sodales commodo. Donec tellus arcu, congue porta ultrices non, pretium et sapien. Proin mattis risus dignissim feugiat tristique. Donec nibh lorem, facilisis id posuere ut, varius ac urna. Etiam ultrices dignissim mauris, quis venenatis ex semper ut.

Curabitur id fermentum erat, rhoncus scelerisque est. Sed pulvinar, nulla sed sollicitudin scelerisque, ipsum erat sollicitudin dolor, ut commodo arcu justo vel libero. Curabitur turpis dolor, fermentum ut elit a, vehicula commodo nunc. Sed sit amet blandit nulla, quis sodales massa. Donec lobortis, urna vel volutpat ullamcorper, mauris est efficitur nulla, et suscipit velit dui at metus. Aliquam id sem sed metus tristique scelerisque nec vitae odio. Phasellus a pellentesque libero, vel convallis metus. Sed nec fringilla magna, non varius ex. Sed interdum eleifend ligula, quis porta enim ultrices a. Donec hendrerit diam ac elementum tincidunt.

Pellentesque eget nisl rhoncus, malesuada justo nec, suscipit quam. Nam sodales mauris eu bibendum suscipit. Vivamus sodales dui lorem, scelerisque pellentesque diam fermentum sed. Etiam fermentum nisl id nisl blandit, sit amet semper erat ultricies. Nulla tincidunt nulla metus, eu imperdiet lorem malesuada sagittis. Maecenas accumsan risus sed ante eleifend, vitae pretium leo porta. Suspendisse vitae eros vitae dui ornare condimentum id sit amet mauris. Etiam tincidunt consequat risus, eu posuere mi. Donec ut nunc eu massa porttitor suscipit nec nec neque. Suspendisse vitae tincidunt justo, sed molestie velit. Nullam pellentesque convallis ante, vel posuere libero blandit in.

(message "Hello again")
Code Snippet 2: Hello Again

Here we refer to 1.

Page (Debug)

Page VariableValue
Name "Links to source blocks"
Title "Links to source blocks"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/links-to-source-blocks/"
RelPermalink "/posts/links-to-source-blocks/"
page.Data{} (type:page.Data)
NextPageLinks to Org Targets
PrevPageLinks to tables
NextInSectionLinks to Org Targets
PrevInSectionLinks to tables

Page Params (Debug)

descriptionstring "Test for internal links to source block references."
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-05-27 10:49:08 -0400 -0400
tags[]string "links" "internal-links" "src-block"
titlestring "Links to source blocks"

File Object (Debug)

FileInfo VariableValue
UniqueID "41205caa10bf1bb29a395b2362c3d38d"
BaseFileName "links-to-source-blocks"
TranslationBaseName "links-to-source-blocks"
Lang "en"
Section "posts"
LogicalName "links-to-source-blocks.md"
Dir "posts/"
Ext "md"
Path "posts/links-to-source-blocks.md"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.99.1 (commit d524067382e60ce2a2248c3133a1b3af206b6ef1) . This site is powered by Netlify.
[Test Site home | ox-hugo home]