【问题标题】:I get no image in the viewer panel when I run blogdown's serve_site()运行 blogdown 的 serve_site() 时,查看器面板中没有图像
【发布时间】:2021-11-09 00:27:03
【问题描述】:

我使用以下代码创建了带有 HUGO 0.88.1 的 blogdown 站点;

new_site(theme = 'puresyntax71/hugo-theme-chunky-poster',
         format = 'toml')

根据我所遵循的说明,应该在查看器面板上加载一个站点,而这并没有发生。

我已经尝试了 check_site() 函数并且在我得到的结果内;

Checking .gitignore
| Checking for items to remove...
○ Nothing to see here - found no items to remove.
| Checking for items to change...
○ Nothing to see here - found no items to change.
| Checking for items you can safely ignore...
○ Found! You have safely ignored: .DS_Store, Thumbs.db
| Checking for items to ignore if you build the site on Netlify...
● [TODO] When Netlify builds your site, you can safely add to .gitignore: /public/, /resources/
| Checking for files required by blogdown but not committed...
● [TODO] Found 1 file that should be committed in GIT:

  layouts/shortcodes/blogdown/postref.html

所以我去检查上面提到的短代码,它有以下内容;

{{ if eq (getenv "BLOGDOWN_POST_RELREF") "true" }}{{ .Page.RelPermalink }}{{ else }}{{ .Page.Permalink }}{{ end }}

如何按照指示将该文件提交到 GIT?这就是我没有预览网站的原因吗?

注意:我之前没有提到的重要信息;以下是我尝试serve_site()时收到的错误代码

Launching the server via the command:
  C:/Users/User/AppData/Roaming/Hugo/0.88.1/hugo.exe server --bind 127.0.0.1 -p 4321 --themesDir themes -t hugo-theme-chunky-poster -D -F --navigateToChanged
Error: "C:\Users\User\Documents\20210913_blogdown\web-tea\config.toml:1:1": unmarshal failed: toml: table markup already exists

【问题讨论】:

    标签: r git r-markdown hugo blogdown


    【解决方案1】:

    更新:此错误消息

    错误:“C:\Users\User\Documents\20210913_blogdown\web-tea\config.toml:1:1”:解组失败:toml:表标记已存在

    表示您在config.toml 中有两个markup 字段,如下所示:

    [markup]
      [markup.highlight]
        codeFences = false
    
    [markup]
      [markup.goldmark]
        [markup.goldmark.renderer]
          unsafe = true
    

    你必须像这样合并它们:

    [markup]
      [markup.highlight]
        codeFences = false
      [markup.goldmark]
        [markup.goldmark.renderer]
          unsafe = true
    

    我无法重现您的问题。这个主题似乎需要 Instagram 的访问令牌。我刚刚在accessToken 中配置了一个任意字符串,就像在config.toml 中这样:

    [services]
      [services.instagram]
        disableInlineCSS = true
        accessToken = "aaaa"
    

    然后blogdown::serve_site() 工作正常。

    【讨论】:

    • 您好,感谢您的回复!我试图为 Instagram 获取访问令牌,但事实证明,对于菜鸟(我)来说,没有 facebook 帐户有点棘手,是否有办法从 config.toml 文件中删除主题对令牌的要求?我尝试删除服务代码,但网站仍然没有加载到预览窗格中。
    • 我现在从您的原始问题中的编辑中看到了问题。将在一分钟内编辑我的答案。
    • 效果很好!感谢您的帮助和支持!!!
    猜你喜欢
    • 1970-01-01
    • 2021-02-09
    • 2022-01-22
    • 1970-01-01
    • 2021-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-12
    相关资源
    最近更新 更多