将iframe Amazon Associate Link嵌入到.md文件R中 [英] Embed iframe Amazon Associate Link into .md file R

查看:153
本文介绍了将iframe Amazon Associate Link嵌入到.md文件R中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Amazon Associate链接嵌入到使用R blogdown和Hugo创建的帖子中.这是一个简单的.md文件. Amazon Associate网站位于此处.

我要使用商店ID发布的代码是这样的:

<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>

当我在本地投放网站时,在应该显示广告的位置看不到任何东西.当我发布代码时,在应该显示广告的位置也看不到任何东西.

因为它是一个.md文件,所以我认为它只需使用HTML标记即可工作.显然,这不是我的情况.

如果要紧,我正在使用GitHub作为存储库,并使用Netlify作为宿主.

有什么建议吗?是否有任何程序包或更简单的方法来嵌入Amazon Associate链接?

解决方案

如果您使用的是Hugo v0.60.0 +,并且要在.md文件中使用原始HTML,请在config.yaml中添加以下内容.

>

 markup:
  goldmark:
    renderer:
      unsafe: true
 

使用此不安全"设置,Hugo将通过原始HTML格式,例如< br>. —到目标文件.

这是我的 14.2标记部分的节选雨果教程.有关更多信息,请参阅Hugo文档中的配置标记.

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?

解决方案

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.

这篇关于将iframe Amazon Associate Link嵌入到.md文件R中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆