menu

Academic

Chat about Source Themes Academic, the page builder for Hugo 👩‍💻📝🚀

Channels
Team

Including content in any page via widgets

June 5, 2020 at 4:10pm

Including content in any page via widgets

June 5, 2020 at 4:10pm (Edited 3 weeks ago)
Hi! Is it possible to use a widget to include a specific selection of content (say, a specific publication, given its URL) within any page?
Say I have a page /post/story.md where I talk about publication /publication/xyz.md - at some point I'd like to cite it, and include the full details of it at the end of the page. Of course I don't want to rewrite title/author/date/etc: I'd like to use a widget to list only that publication.
I've read the instructions here https://sourcethemes.com/academic/docs/page-builder/#featured but it seems that I'm forced to create sub-pages in order to do that.
Is there any simpler way?

June 6, 2020 at 11:03am
There are a number of different approaches to linking (referencing and cross-referencing) content in Academic. These include the following options amongst others.
Widgets can be added to Widget Pages. Hence, one option could be to create a dedicated Widget Page for a topic and add your desired widgets.
Projects or Tags are a common way to group related content together.
Content can be linked directly by placing a button in the page header (such as using the links front matter option) or by placing a standard Markdown link in the page body.
Markdown footnotes are another approach to cite a publication.
There's also a more automated approach proposed specifically for citing publications. Feel free to contribute to that.
Perhaps less relevant to the question but also available is recommended content which can appear at the bottom of pages based on the show_related option.
Edited
  • reply
  • like
Thanks. I was aware of all these things. Is it possible to re-use the same code that produces the output of the publications.md widget in the home page, but within a shortcode?
Something like {{< render "publication/xyz.md" >}}. Of course I'm willing to write such a shortcode by reusing the code that produces the widget. Can you help me find such code?
  • reply
  • like
This! I found the way:
_layouts/shortcodes/cite.html
{{ with .Site.GetPage (.Get 0) }}
{{ partial "li_citation" . }}
{{end}}
Which I can call as:
{{< cite id_of_the_publication >}}
Edited
  • reply
  • like