Try use mathematic functionality

Hello,

I followed the instructions provided in this link Mathematics in markdown | Hugo to use a certain mathematical functionality. However, it did not work for me when I applied it to the Shadocs theme. I wanted to know if there are any specific requirements that I need to know to use this functionality with this theme.

Please note that I am new to this and may not be proficient. Thank you for your understanding.

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Lots of first times for me. Here is the link to my repository:

As mentioned, in my previous post I tried to follow the instructions in this

Thanks for your help

First, override the baseof.html from the theme by placing a copy in the same path in the layouts directory in the root of your project

cp themes/ananke/layouts/_default/baseof.html layouts/_default/baseof.html

Next, put this bit just before the closing head tag in the baseof.html template:

{{ if .Param "math" }}
  {{ partialCached "math.html" . }}
{{ end }}

Now visit your sqrt page.

image

2 Likes

Fantastic! Thanks for your help!
Charles

Hi @jmooring . Can you tell me, why it doesn’t work when I change the theme for Shadocs?
I made this change in my repo:

Thanks, Charles

Because you need to override the relevant template for the shadocs theme, similar to what you did with the ananke theme.

themes/shadocs/layouts/partials/main.html

When I copied
cp themes/shadocs/layouts/partials/main.html layouts/partial/main.html
and added math argument in main.html
{{ if .Param “math” }}
{{ partialCached “math.html” . }}
{{ end }}

I received this error

.Param is a method on a Page object. The Page object is not in context within the partial.

I suspect this will work…

{{ if .root.Param "math" }}
  {{ partialCached "math.html" .root }}
{{ end }}

But you should really be asking the theme author.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.