Jekyll私人部署? [英] Jekyll private deployment?

查看:117
本文介绍了Jekyll私人部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了jekyll网站.关于部署,我不想托管在github页面上.为了托管私有域,我从文档中得知可以复制_site文件夹中的所有文件.都是邪恶的.

I have created jekyll site. Regarding the deployment I don't want to host on github pages. To host private domain I came know from documentation to copy the all files from _site folder. That's all wicked.

问题:

  1. 每次添加新博客文章时,我将运行cmd> jekyll build,然后将新创建的html复制到托管域.有什么简单的方法可以更新而无需每次编译?

  1. Each time I add new blog post, I am running cmd>jekyll build then I am copying newly created html to hosted domain. Is there any easy way to update without compiling each time ?

之所以问我,是因为它将由非技术人员进行更新

The reason, Why I am asking is because it will updated by non technical person

感谢您的帮助!

推荐答案

如果您不想使用GitHub Pages,那么AFAIK就是您每次进行更改时都只能编译您的网站.

If you don't want to use GitHub Pages, AFAIK there's no other way than to compile your site each time you make a change.

但是您当然可以尽可能地执行脚本/自动化.
我也是用自己的博客来做的.我将其托管在自己的Web空间而不是GitHub Pages上,因此我需要对每个更新执行以下步骤:

But of course you can script/automate as much as possible.
That's what I do with my own blog as well. I'm hosting it on my own webspace instead of GitHub Pages, so I need to do these steps for each update:

  1. 在本地计算机上编译
  2. 通过FTP上传

我可以单击一下(好的,双击 ).

I can do this with a single click (okay, a single double-click).

注意:我在Windows上,因此以下解决方案适用于Windows.
但是,如果您使用的是Linux/MacOS/Linux,则当然可以使用那里提供的工具来构建类似的东西.

Note: I'm on Windows, so the following solution is for Windows.
But if you're using Linux/MacOS/whatever, of course you can use the tools given there to build something similar.

我正在使用批处理文件 (Windows与 shell脚本)来编译我的网站,然后调用

I'm using a batch file (the Windows equivalent to a shell script) to compile my site and then call WinSCP, a free command-line FTP client.

WinSCP允许我存储会话配置,因此我将连接保存到服务器上在那里一次.
因此,我不想将WinSCP提交到我的(公共)存储库,因此我的脚本希望WinSCP在父文件夹中.

WinSCP allows me to store session configurations, so I saved the connection to my server there once.
Because of this, I didn't want to commit WinSCP to my (public) repository, so my script expects WinSCP in the parent folder.

批处理文件如下:

call jekyll build

echo If the build succeeded, press RETURN to upload!

pause

set uploadpath=%~dp0\_site
%~dp0\..\winscp.com /script=build-upload.txt /xmllog=build-upload.log

pause

WinSCP调用(/script=build-upload.txt)中的第一个参数指定脚本文件,其中包含实际的WinSCP命令

The first parameter in the WinSCP call (/script=build-upload.txt) specifies the script file which contains the actual WinSCP commands

这在脚本文件中:

option batch abort
option confirm off

open blog
synchronize remote -delete "%uploadpath%"

close
exit

一些解释:

  1. %~dp0 (在批处理文件中)是当前批处理文件所在的文件夹
  2. set uploadpath=...(在批处理文件中)将生成的网站的完整路径保存到环境变量
  3. open blog(在脚本文件中)打开与预先保存的会话配置(我将其命名为blog)
  4. synchronize remote ...(在脚本文件中)使用 命令,从本地文件夹(保存在%uploadpath%中,这是步骤2中的环境变量)到服务器.
  1. %~dp0 (in the batch file) is the folder where the current batch file is
  2. The set uploadpath=... line (in the batch file) saves the complete path to the generated site into an environment variable
  3. The open blog line (in the script file) opens a connection to the pre-saved session configuration (which I named blog)
  4. The synchronize remote ... line (in the script file) uses the synchronize command to sync from the local folder (saved in %uploadpath%, the environment variable from step 2) to the server.


IMO此解决方案也适用于非技术人员.
如果您的技术人员不知道如何使用源代码控制,您甚至可以脚本提交&也在推.


IMO this solution is suitable for non-technical persons as well.
If the technical person in your case doesn't know how to use source control, you could even script committing & pushing, too.

这篇关于Jekyll私人部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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