【问题标题】:How to generate new content with Hyde?如何使用 Hyde 生成新内容?
【发布时间】:2012-01-07 23:12:38
【问题描述】:

我开始学习 Hyde 并且我已经从 Github 克隆了一些用 Hyde 编写的博客。我可以在我的网络浏览器中成功生成这些示例博客并在本地提供它们;但是,我似乎无法弄清楚如何实际生成新内容。例如,如何在 HTML 或 Markdown 中添加新文件,然后将文件提供给站点?我在docs 中没有看到如何执行此操作。我错过了什么?我正在使用的示例博客的目录结构如下所示:

---content
    ---about
    ---blog  
---deploy
    ---about
    ---blog
---layout
   ---base.j2
   ---listing.j2
   ---posts.j2
---info.yaml
---site.yaml

谁能解释如何添加 HTML 或 markdown 文件并提供它们?

【问题讨论】:

    标签: python django jekyll hyde


    【解决方案1】:

    Hyde 没有创建新文件的命令。您可以在您喜欢的编辑器中创建文件并将其保存在正确的目录中。

    例如,如果您想要使用此 url 的博客文章: http://localhost:8080/blog/2012/01/05/a-new-post,

    您已执行以下操作:

    1. 在您的内容文件夹下创建目录blog/2010/01/05
    2. 使用文本编辑器创建您的帖子
    3. 将文件保存在您在步骤 1 中创建的目录中
    4. 当您执行hyde genhyde serve 时 - 您将看到该文件显示在该网址中

    【讨论】:

    • 非常感谢您的回答以及您在 hyde 上所做的所有工作!
    【解决方案2】:

    我编写了一个名为 Ghorg 的项目,它提供了一个命令行实用程序,用于管理一组 org 模式的博客文章、将它们作为 html 发布到您的 hyde 站点,以及调用 hyde 生成和发布功能。这纯粹是一种方便的实用程序,因为您不再需要访问您的站点存储库来使用它。

    我想,比如说,一些 vim 用户或想要帖子管理但不想 org-mode 发布但可能是 markdown 或其他东西的人(现在它的硬编码只是打开 emacs) - 如果这些人想提供帮助让它更通用,那就太好了。

    Ghorg: Org for Hyde

        dlacewell@scarf$ ghorg -h
        usage: ghorg [-h] [-b] [-p] [-s SITE] [--config CONFIG] [-l] [-n [N]] [-P]
                     [-U] [-e] [-t TEMPLATE] [-D]
                     [title [title ...]]
    
        Manage your Ghorg blog.
    
        positional arguments:
          title                 all arguments will be joined with hyphen for filename
                                `ghorg post title' => `2012-01-12-post-title.org'
    
        optional arguments:
           h, --help            show this help message and exit
           b, --build           Perform configured Hyde build step.
           p, --publish         Perform configured Hyde publishing step. (implies -b/--        build)
           s SITE, --site SITE  Path to the root of the Hyde site.
           config CONFIG        Filename of Hyde configuration for building.
           l, --list            List previous posts (-n to change count).
           n [N]                Change number of posts listed (default:5).
           P                    Set post as published.
           U                    Set post as unpublished.
           e                    Mix with -P/-U to edit while changing publishing
                                status.
           t TEMPLATE           Location of template for new posts.
           D                    Delete existing post.        
    

    【讨论】:

      猜你喜欢
      • 2022-08-14
      • 1970-01-01
      • 2011-02-08
      • 2013-11-23
      • 2021-01-24
      • 2011-05-20
      • 1970-01-01
      相关资源
      最近更新 更多