Tag: ghost

在Hexo中添加图像作为variables(ejs模板)

在我的.md文件中,我将blogpost-image指定为一个新的前端variables。 在我的article.ejs文件中,我有以下内容: <div class="blogpost-image"><span><img src=""></span><%- post.blogpost-image %><div></div></div> 在我的.md文件中,我有这个path… blogpost-image: /images/test.jpg 如何使它在Hexo中的图像? 当我对文本值做同样的处理时,比如author: John Doe它完美的工作。

htaccess与www.example.com,但不是example.com

我已经安装了需要nodejs运行的Ghost。 我通过托pipe托pipe在Apache Linux服务器上执行此操作。 他们好心让我loginSSH访问,所以我已经能够使用标准的安装说明设置nodejs和Ghost。 我将ghost安装到了我的域的根目录下,所以在正常的操作中,有人会去example.com,它会显示我的博客。 那就是我所希望的。 但是现在当我在浏览器中加载Ghost的时候,我发现,因为我按照自己的方式访问Ghost,并且Ghost没有configuration服务器,所以我似乎需要一个htaccess文件才能使网站到达。 所以,我创build了这个htaccess文件: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ http://127.0.0.1:65515/ [P,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ http://127.0.0.1:65515/$1 [P,L] </IfModule> 保存到根目录,如果我去example.com/ghost(Ghost的pipe理面板),它的工作原理。 没有错,看起来不错。 但是,如果我尝试访问根目录(即goto example.com),而不是向我显示索引,则会显示index.js – 即从字面上加载Ghost的index.js文件的内容并显示它,而不是parsing它并显示该网站的主要索引。 但是,如果我去www.example.com那么一切正常。 所以不pipe是什么问题是因为我没有使用www。 在域中。 我宁愿它在URL中使用或不使用www。 我曾尝试添加一些解决scheme,将www.example.com的非www请求redirect到ehtaccess,但由于某种原因,它仍然不起作用(如果我inputexample.com,它不会将我redirect到www.example .COM)。

node.js heroku由于缺less依赖关系,Ghost无法启动:无法find模块

我一直在这工作几个小时,没有运气。 我刚刚下载了Ghost 0.7.0到我的本地机器上,开箱即用, npm start工作完美。 我尝试安装我的第一个包时遇到错误。 我正在安装的软件包是ghost-s3-storage 。 但是,在部署到heroku时,所有包都返回类似的错误。 这是我的步骤… $ npm start -> works $ npm install –save ghost-s3-storage $ npm start -> still works 所以,现在我的package.json包含准确的依赖关系,所以Heroku应该正确部署,但它不。 这似乎是由Heroku运行的三个命令引起的(根据他们的指南 )。 当我在本地运行命令时,我可以复制错误。 $ rm -rf node_modules $ npm install –quiet –production $ npm start -> ERROR: Ghost is unable to start due to missing dependencies: Cannot find […]

重新启动在Docker内运行的幽灵博客

我正在使用官方Ghost Docker Image ,并且运行ghost时没有问题。 我正在主机上开发一个主题,在主机上作为一个卷装入容器。 与任何正在运行的ghost实例一样,为了查看主题更改,我需要停止并重新启动ghost。 通常这只是意味着结束Node进程并再次运行npm start 。 但是在官方Docker镜像中,这不是一个选项。 如果我尝试运行npm start ,我会被告知: ERROR: (EADDRINUSE) Cannot start Ghost. 这是有道理的,因为港口已经在使用。 我试过手动杀死进程没有成功。 如果我杀死节点进程 kill -9 *node process ID* 容器崩溃了。 我也尝试过杀死npm进程,但是这似乎永远不会下降。 有任何想法吗?

带NPM模块的API调用'got'

我已经在ReactJS中设置了一个组件来调用GhostJS的API来显示post,但是我收到错误消息: HomePage.js:30 Uncaught (in promise) TypeError: Cannot read property 'body' of undefined(…) 以下是示例组件。 我是否应该在我自己的网站中直接引用Ghost的API或API? 他们的API的Ghost文档没有很好的解释这个部分。 除了调用他们的API,我已经尝试调用我的网站API通过replace根URL到这个输出: got(`http://localhost:2368/posts/${postId}`)… 这里有什么不对吗?

当我用幽灵cli安装鬼我得到错误

我有一个与MySQL服务器和Nginx的CentOS 7机器。 我用yum install nodejs和ghost-cli安装了nodejs。 我想用鬼气来安装幽灵。 但是当我input鬼安装commant我得到这个错误: ✖ Checking system Node.js version A SystemError occurred. Message: The version of Ghost-CLI you are running was not installed with this version of Node. This means there are likely two versions of Node running on your system, please ensure that you are only running one global version of […]

如何限制节点进程的CPU和内存使用量

我想通过GitHub在共享服务器上安装一个Ghost博客 。 在安装过程中,我需要运行npm install, grunt init和grunt prod 。 我的主机提供了500 MB的内存使用量,如果一个进程使用超过600 MB的内存,他会杀死它。 因此,我需要一个选项来限制这些进程的内存使用情况,因为它们都需要超过500 MB的内存! 我试图用–max-old-space-size=450来运行这个进程,但是它似乎不起作用。 如果有人能够给我提供一个关于使用选项运行节点进程的教程或文档的链接,我会很高兴。 谢谢!

在部署node.js应用程序之后,ghost博客部分会中断

我有一个node.js应用程序,其中一个视图是一个ghost.js博客,我通过遵循Ghost的wiki文章Using Ghost作为npm模块进行了整合。 目前,我的本地版本完美地工作。 错误: 当我访问部署的网站时,一切工作正常,除了当我到mysite.heroku.com/blog ,在这一点上,我得到的鬼页面看起来像 。 我注意到应用程序有两个同时运行的本地主机分支( localhost:3000和localhost:2368/ )。 我不确定这是否会导致错误。 我已经检查了我的Heroku日志,他们没有提供任何比GET请求发送到/blog更多的细节,首先返回301 ,然后是404错误。 另外,知道当我点击Go to front page链接时,它会发送给我http://localhost:2368/ 我的config.js文件如下所示: var path = require('path'), config; config = { // ### Production // When running Ghost in the wild, use the production environment // Configure your URL and mail settings here production: { url: 'http://example.com/blog', mail: {}, database: […]

Heroku fork – 该附加计划仅适用于select用户

我在Heroku上部署了一个生产阶段的应用程序。 我想分发应用程序来build立一个临时环境。 Input heroku fork –from <app_name>-production –to <app_name>-staging Output Forking <app_name>-production… done. Forked to <app_name>-staging Setting buildpacks… done Adding newrelic:wayne to <app_name>-staging as NEW_RELIC… done Adding deployhooks:http to <app_name>-staging as DEPLOYHOOKS_HTTP… done Adding heroku-postgresql:standard-yanari to <app_name>-staging as HEROKU_POSTGRESQL_MAROON…! That add-on plan is only available to select users. There was an error forking to <app_name>-staging. […]

是否有可能在Ghost中注册自定义助手?

按照本指南,我使用Ghost作为npm模块。 我想添加一些自定义帮助,我可以利用我的主题。 有没有办法做到这一点,而无需更改Ghost模块中的代码? 这是我现在的代码 const ghost = require('ghost'); const path = require('path'); const hbs = require('express-hbs'); const config = path.join(__dirname, 'config.js'); const coreHelpers = {}; coreHelpers.sd_nls = require('./sd_nls'); // Register a handlebars helper for themes function registerThemeHelper(name, fn) { hbs.registerHelper(name, fn); } registerThemeHelper('sd_nls', coreHelpers.sd_nls); ghost({ config: config }) .then(ghostServer => ghostServer.start()); 我认为一个可能的问题是我的hbs是一个新的handlebars实例,与Ghost使用的不同,因此当Ghost运行时,它不包含我已注册的任何helpers。