Open corei8 opened 1 year ago
For me it is working only locally when I run the hugo server. On my website https://sysadmin.info.pl/pl/blog/moja-praca-inzynierska/ it does not work. the repository from github is taken by netlify and I added my custom domain. I have no idea is it possible to add CORS to netlify.
I know the solution. First of all in my case I had to change in config.toml a base URL to this
baseURL = "/"
Then in the netlify.toml (because I am using netlify) I had to define headers this way:
[build]
command = "hugo"
publish = "public"
[build.environment]
HUGO_VERSION = "0.111.3"
[[headers]]
for = "/*"
[headers.values]
Access-Control-Allow-Origin = "sysadmin.info.pl"
After that in my md file where I am using a shortcode I defined it this way:
{{< embed-pdf url="../../../files/document.pdf" renderPageNum="1" >}}
Because I keep the PDF file in the directory
/root dir of my site/static/files
And my md file where I am using the shortcode is located here:
/root dir of my site/content/pl/blog
This way I solved the problem. I think you can try. If you have any questions, do not hesitate to ask me, please.
@corei8 @sysadmin-info You can take a look at how the shortcode is embedded and the Hugo site config in the demo site here
This site is built with the minimal theme and is deployed using Netlify.
@corei8 @sysadmin-info You can take a look at how the shortcode is embedded and the Hugo site config in the demo site here
This site is built with the minimal theme and is deployed using Netlify.
I figured it out. In the config.toml where the base url is defined instead of / it has to be https://example.com/ not https://example.com or / The / at the end of the address is crucial.
The initial installation did not work at all. But then I ran across this guide and I can get the shortcode to start loading the PDF, but it never actually loads it: the wheel just keeps on spinning.
I figured it out. In the config.toml where the base url is defined instead of / it has to be https://example.com/ not https://example.com or / The / at the end of the address is crucial.
I also have this issue even when using
hugo server --baseURL "/"
I also have this issue even when using
hugo server --baseURL "/"
Read one more time carefully my answer. I figured it out. In the config.toml where the base url is defined instead of / it has to be https://example.com/ not https://example.com or / The / at the end of the address is crucial. So instead / use your base address with / at the end eg. https://sysadmin.info.pl/
The initial installation did not work at all. But then I ran across this guide and I can get the shortcode to start loading the PDF, but it never actually loads it: the wheel just keeps on spinning.