请原谅可能重复的问题,其他人的解决方案并没有解决我的问题。我正在开发一个 Hugo 网站并尝试嵌入一个 iframe。该元素显示,但我收到消息“此内容已被阻止”。请联系网站所有者来解决问题。” 当它加载时,任何人都看不到内容。
这是我的 .md 信息
+++
title = "Resources"
description = "Hugo, the world's fastest framework for building websites"
date = "2019-02-28"
aliases = ["about-us", "about-hugo", "contact"]
author = "Hugo Authors"
+++
<iframe src="//docs.google.com/spreadsheets...."></iframe>
Run Code Online (Sandbox Code Playgroud)
我还通过添加以下内容更新了我的 config.toml 文件:
[markup.goldmark.renderer]
unsafe = true
Run Code Online (Sandbox Code Playgroud)
我不确定我错过了什么。如果您需要有关我所做工作的更多信息,请告诉我。我也尝试过短代码,但根本不会渲染任何内容(我对短代码仍然很陌生,这就是我嵌入 iframe 的原因)。
感谢您的时间和考虑。
我有一系列包含食谱的嵌套部分,按菜肴类型分组,例如:
\ncontent\n\xe2\x94\x94\xe2\x94\x80 recipes\n \xc2\xa0 \xe2\x94\x9c\xe2\x94\x80 _index.md\n \xc2\xa0 \xe2\x94\x9c\xe2\x94\x80 bread\n \xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0\xe2\x94\x9c\xe2\x94\x80 _index.md\n \xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0\xe2\x94\x9c\xe2\x94\x80 beer_rolls.md\n \xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0\xe2\x94\x9c\xe2\x94\x80 ciabatta.md\n \xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0\xe2\x94\x94\xe2\x94\x80 potato_bread.md\n \xe2\x94\x9c\xe2\x94\x80 dessert\n \xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0\xe2\x94\x9c\xe2\x94\x80 _index.md\n \xe2\x94\x82\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80 chocolate_brownies.md\n \xe2\x94\x82\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80 elderberry_pie.md\n \xe2\x94\x82\xc2\xa0 \xe2\x94\x94\xe2\x94\x80 victoria_sponge_cake.md\n \xe2\x94\x94\xe2\x94\x80 mains\n \xe2\x94\x9c\xe2\x94\x80 _index.md\n \xe2\x94\x9c\xe2\x94\x80 bean_chilli.md\n \xe2\x94\x9c\xe2\x94\x80 braised_leeks.md\n \xe2\x94\x94\xe2\x94\x80 yorkshire_pudding.md\nRun Code Online (Sandbox Code Playgroud)\n我想编写一个list.htmlfor content/recipes/_index.md,以生成反映 中目录结构的嵌套列表recipes/,以便列表的第一级链接到小节,例如breador dessert,列表的第二级链接到各个食谱,例如bread/beer_rolls.mdor mains_bean_chilli.md。
其中包含什么list.html?我是否需要有多个list.html文件,每个嵌套小节一个?
我\xe2\x80\x99m 构建了一个个人hugo 网站并通过Gitlab 页面部署它。到目前为止,这工作得很好,除了我最近遇到的一个奇怪的错误:\nI\xe2\x80\x99ve 将我的主页从 \xe2\x80\x9c_index.md\xe2\x80\x9d 更改为 \xe2\x80\x9cindex .md\xe2\x80\x9d(树中最顶层的索引文件),以便将子文件夹中的图片作为页面资源访问,而我\xe2\x80\x99无法使用名为\xe2\x80\x9c_index的文件来访问它.md\xe2\x80\x9d。这在本地构建页面效果很好(使用hugo 0.88.1),但是当我\xe2\x80\x99将这些更改上传到Gitlab时,我的gitlab页面变得几乎是空的(没有内容(包含图片),只有标题和页脚)。
\n我\xe2\x80\x99已经用gitlab-ci玩了一段时间,以便追踪它。\n结果页面如预期:文件\xc2\xb7 bd036ee1b5eee9481cda3673414dcaff8a2753da \xc2\xb7 Roy Meissner / rmeissn.gitlab.io \xc2\xb7 GitLab 2 \ nResulting页面几乎是空的:文件\ xc2 \ xb7 E885460A88AE 9B7E6F1356FCDCB90AC4A33C5351 \ XC2 \ XC2 \ XB7 ROY MEISSNER / RMEISSNER / RMEISSNN.GITLAB.GITLAB.IO \ XC2 \ XC2 \ XB7 GITHAB 2 x80 \ x9c_index.md \xe2\x80\x9d 到 \xe2\x80\x9cindex.md\xe2\x80\x9d。这不会在本地或 gitlab-ci 上引发任何 CLI 警告/错误。
\ngitlab 构建工件中几乎为空的 index.html 的内容:
\n<!doctype html><html lang=de-de><head>\n<meta charset=utf-8>\n<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">\n<meta name=description content="Hompage of Roy Meissner">\n<meta name=author content="Roy Meissner">\n<title>Webseite \xc3\xbcber Roy …Run Code Online (Sandbox Code Playgroud) 我正在使用此命令在带有 M1 芯片的 MacBook Pro 中运行hugo 项目:
\nhugo new site example\ncd example\nhugo server\nRun Code Online (Sandbox Code Playgroud)\n输出日志如下:
\n\xe2\x9e\x9c example hugo server\nStart building sites \xe2\x80\xa6\nhugo v0.92.0+extended darwin/arm64 BuildDate=unknown\nWARN 2022/03/27 15:49:33 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.\nWARN 2022/03/27 15:49:33 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.\nWARN 2022/03/27 …Run Code Online (Sandbox Code Playgroud) 如何注释雨果中的内容?
如果我有笔记,未完成的想法,我想将其保留在.md文件中,但不要将其出现在中html。
<!-- 标签似乎不起作用-甚至没有成为html注释,它仍在页面上显示为可见文本。
我正在寻找使用静态站点生成器来构建一些即将推出的网站,并且正在与 Jekyll 和 Hugo 混在一起。这些网站将是自定义的 Bootstrap 风格设计,而不是来自预建主题的任何内容。在与两者混在一起之后,我喜欢使用 Hugo 的外观。
无论如何,通过他们的文档,我遇到了一个问题。我是否需要为每个站点创建一个“主题”,还是可以将所有内容都保存在全局 /layouts、/static、/archetypes 等文件夹中?
我不打算将这些设计打包为可重用的主题,而且当我尝试记住 Hugo 将这些模板文件优先于其他模板文件的顺序时,这似乎是不必要的卷积来嵌套更深的内容。
我正在尝试建立一个模板,用于在中生成Twitter Card blogdown。它放入以下内容layouts/partials/twitter-card.html:
<meta name="twitter:site" content="@myname">
<meta name="twitter:creator" content="@myname">
{{ if .IsPage }}
<meta name="twitter:description" content="{{ .Summary }}" />
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ .Params.image }}" /> {{ else }}
<meta name="twitter:title" content="{{ .Site.Title }}" />
<meta name="twitter:description" content="{{ .Description }}" /> {{ end }}
Run Code Online (Sandbox Code Playgroud)
以及以下内容layouts/partials/head.html:
{{ partial "twitter-card" . }}
Run Code Online (Sandbox Code Playgroud)
在给定的博客文章foo.Rmd中,我将其放在YAML中:
image: "static/post/foo/figure-html/some_image.png"
Run Code Online (Sandbox Code Playgroud)
当我让hugo生成帖子时,一切正常,我得到:
<meta name="twitter:image" content="static/post/fixed-points_files/figure-html/some_image.png" />
Run Code Online (Sandbox Code Playgroud)
但是,当我预览我的Twitter卡时,图片不会显示。我想我必须在YAML前端设置一个不同的路径,但是我找不到关于路径格式应该是什么的文档,并且所有教程在其示例中都使用绝对URL。
我正在尝试构建我的hugo网站,但是当我运行时,hugo check我看到以下错误日志:
ERROR: 2017/09/10 Current theme does not support Hugo version 0.14. Minimum version required is 0.18
ERROR: 2017/09/10 template: theme/_default/baseof.html:2: function "default" not defined
ERROR: 2017/09/10 template: redefinition of template "main"
ERROR: 2017/09/10 template: theme/_default/single.html:7: function "humanize" not defined
ERROR: 2017/09/10 template: redefinition of template "main"
ERROR: 2017/09/10 template: theme/_default/terms.html:12: function "relLangURL" not defined
ERROR: 2017/09/10 template: theme/index.html:6: function "default" not defined
ERROR: 2017/09/10 template: theme/partials/menu-contextual.html:12: function "humanize" not defined
ERROR: 2017/09/10 template: theme/partials/page-header.html:9: function "default" not …Run Code Online (Sandbox Code Playgroud) 只要我一直在使用它(至少两年),我就无法在 Hugo 中突出显示“当前菜单项”。
如果我在我的内容文件中使用 frontmatter 来定义菜单(即将每个内容单独添加到菜单中),这似乎是可能的。但是,我不想用这些信息在我的内容文件的前面乱扔垃圾,尤其是看到如何使用主配置文件定义菜单。
这是我在配置文件中声明菜单的方式(我更喜欢使用 JSON 而不是 YAML):
"menu": {
"main": [
{
"name": "Home",
"weight": 1,
"url": "/"
},
{
"name": "About",
"weight": 2,
"url": "/about"
},
{
"name": "Blog",
"weight": 3,
"url": "/blog"
},
{
"name": "Contact",
"weight": 4,
"url": "/contact"
}
]
},
Run Code Online (Sandbox Code Playgroud)
这是我的菜单模板
<ul class="nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="nav-item nav-item--has-submenu{{ if $currentPage.HasMenuCurrent "main" . }} nav-item--active{{ end }}">
<a class="nav-link" href="javascript:;" title="{{ .Name …Run Code Online (Sandbox Code Playgroud) 几天前,我开始了一个小项目:在我的 Windows 10 机器上对我的 Hugo 构建进行 Dockerizing。作为 Linux 容器运行的 Hugo 容器本身是简单的部分并且似乎可以工作(至少通过查看控制台输出
$ docker run --rm -it -p 1313:1313/tcp hugo:latest
Building sites …
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option cause some error. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
WARN 2019/11/23 14:05:35 found no layout file for "HTML" …Run Code Online (Sandbox Code Playgroud) hugo ×10
css ×2
html ×2
amazon-s3 ×1
blogdown ×1
docker ×1
iframe ×1
javascript ×1
linux ×1
r ×1
r-markdown ×1
twitter ×1
ubuntu ×1
windows-10 ×1