Embed iframe Amazon Associate Link into .md file R

妖精的绣舞 提交于 2020-08-24 04:07:52

问题


I'm trying to embed an Amazon Associate link into a post created using R blogdown and Hugo. It is a simple .md file. The Amazon Associate site is here.

The code I am trying to post with my store-id is this:

<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=qf_sp_asin_til&ad_type=product_link&tracking_id=hatro-20&marketplace=amazon&region=US&placement=B01N6GZW1W&asins=B01N6GZW1W&linkId=2747db84071ed549b5d81ff7076af287&show_border=true&link_opens_in_new_window=true&price_color=333333&title_color=0066c0&bg_color=ffffff">
    </iframe>

When I serve site locally, I see nothing where the ad is supposed to appear. When I publish the code, I see nothing where the ad is supposed to appear either.

Since it's a .md file, I thought it would simply take the HTML tag and work. Apparently, that's not my case.

I am using GitHub as the repository and Netlify as the host if that matters.

Any suggestions? Is there are any packages or easier methods to embed Amazon Associate links?


回答1:


If you are using Hugo v0.60.0+ and want to use raw HTML in your .md file, include the following in your config.yaml.

markup:
  goldmark:
    renderer:
      unsafe: true

With this “unsafe” setting, Hugo will pass raw HTML — for example <br> — through to the destination file.

This is an excerpt of section 14.2 markup in my Hugo Tutorial. For more about this, see Configure Markup in the Hugo Docs.



来源:https://stackoverflow.com/questions/63104559/embed-iframe-amazon-associate-link-into-md-file-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!