Implement scientific sources in my Kirbytext

Hello,

I have blog articles with a structure with sources in a structure with fields like URL, author, date, etc. My goal is to have a text with sources like this:

KirbyText: This is a test [4].
Relates to source no. 4 in my structure field, resulting in this text: This is a test (Some Name, 2020).

Is it right that I can follow this tutorial and thus achieve my basic sources/footnote system by:

  1. Use a custom pattern like [4] which is easy to find via regular expressions (regex),
  2. replace the pattern with a string based on the structure’s fields like author and date and
  3. generate a reference at the end of the article based on all entries in the structure field.

Is this right? Do I miss something here? Of course this is the rough idea as I had no idea if regex stuff is the way to go and if there’s an easier way in Kirby 3.

Best Regards,

I have never tried it but I think if you enable Markdown Extra in the config, you should be able to use footnotes, rather than putting it together in a structure field…

https://michelf.ca/projects/php-markdown/extra/#footnotes

1 Like

You are right about this idea. I forgot that Markdown footnotes exist and are supported by Kirby 3.

I didn’t try that yet. Why I thought about using a structure field was because I’m able to separate my content in different fields so it’s easier to reuse with other softwares and providing APIs with access to specific parts of the content.

You could probably use the tree methods plugin to grab the footnootes from the feild to output into the API route.

2 Likes

Wow . . . I didn’t know this plugin!

Seems like there are different good ways to think about :slight_smile: . Thank you!

Thank you for that tip - I had never heard of the tree methods plugin before, and it’s just what I need today (for an entirely unrelated task)!

If I may chime in with another tip regarding the design of a footnotes implementation: I highly recommend this article - it’s actually rather straightforward (though not entirely obvious) to ensure accessible markup, and easiest when starting fresh.

2 Likes

That’s an excellent solution for footnotes. Thanks for sharing this tutorial!

I like the ideas here, although I’m not sure if my solution will be a classic footnote system but regardless of that, any of the suggested solutions is fine and will help me partially even for my idea and especially for future ideas.

Great work @jimbobrjames and @sebastiangreger!

@sebastiangreger Thanks for sharing that link!