kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
919 stars 528 forks source link

unable to insert raw html to the posts #584

Open grojar opened 1 year ago

grojar commented 1 year ago

Configuration

Issue: I tried to get some stuff in the posts using HTML tags directly in the .md files, but i was unable to do it. I don't know if this is a general problem, some people's problem, or just me, but I'd be very pleased it if you would allow me to share a possible solution for those who might be affected by this issue.

Possible solution: (shortcodes) In this webpage you can find the steps to do it.

I apologize if this post was created in the wrong place.

My best,

Pablo

dacanizares commented 7 months ago

Thank you!

luojing94 commented 4 months ago

I have the same problem

dacanizares commented 4 months ago

Hey @luojing94 !

You can try the possible solution that grojar propossed: Raw html short code

Here is a live example:

  1. Add the rawhtml shorcode: https://github.com/TheScienceOfCode/hugo-tranquilpeak-theme/blob/0eae7fa35a095271d12723edf9dcc57d405727a8/layouts/shortcodes/rawhtml.html

  2. Use it on your post: https://github.com/TheScienceOfCode/thescienceofcode.github.io/blob/0e14609ec5be6de7c5e0b40fcf69cc25fa3415be/content/post/sdl-vscode-c-cpp-debug.en.md?plain=1#L185

  3. Results here: https://thescienceofcode.com/sdl-vscode-c-cpp-debug/

luojing94 commented 4 months ago

@dacanizares Thank you very much I solved it according to your method. Good luck to U!

luojing94 commented 4 months ago

@dacanizares hello ,Sorry for bothering you I have a problem with switching languages. In your example, you have a button that switches between English and Spanish. Can I ask how you do that?

dacanizares commented 4 months ago

Hi @luojing94 !

Sorry for the delay.

Here is the button: https://github.com/TheScienceOfCode/hugo-tranquilpeak-theme/blob/0eae7fa35a095271d12723edf9dcc57d405727a8/layouts/partials/lang_translations.html

Also check my site config: https://github.com/TheScienceOfCode/thescienceofcode.github.io/blob/dev/config.toml

And finally, just create the posts as here: https://github.com/TheScienceOfCode/thescienceofcode.github.io/tree/dev/content/post

Regarding your layout, here you can find config files for internationalization: https://github.com/TheScienceOfCode/hugo-tranquilpeak-theme/tree/0eae7fa35a095271d12723edf9dcc57d405727a8/i18n

Good luck!

luojing94 commented 4 months ago

@dacanizares Thank you! I have found another way these days, but it takes up a lot of space, which is to combine the same blogs in two languages. The reference is https://saltyleo.com/en/1448.html

But I'm going to use your method instead because it's something I really want to master and is better at.

Thank you very much! I wish you all the best~

dacanizares commented 4 months ago

Hey @luojing94 !

You can double-check the official Hugo documentation regarding i18n: https://gohugo.io/content-management/multilingual/

Good luck!