Jekyll内部服务器错误只在博客帖子内(ubuntu)

时间:2016-04-02 21:20:47

标签: ubuntu jekyll

当我告诉Jekyll为我的网站提供服务时,一切顺利,从索引到其他页面。但是,当我点击查看博客文章(任何帖子)时,我开始看到这条消息:

  

内部服务器错误
  不兼容的字符编码:UTF-8和ASCII-8BIT
  WEBrick / 1.3.1(Ruby / 2.1.5 / 2014-11-13)at 127.0.0.1:4000

我在Ubuntu 15.10上运行Jekyll,我正在尝试更新此网站:http://nvinhadeluz.com

编辑---

这是我的_config.yml:

# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely need to edit after that.
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'jekyll serve'. If you change this file, please restart the server process.

# Site settings
title: Núcleo de Promoção Humana Vinha de Luz
email: contato@nvinhadeluz.com
description: > # this means to ignore newlines until "baseurl:"
O Núcleo de Promoção Humana Vinha de Luz é uma entidade filantrópica que busca proporcionar o desenvolvimento humano e social na região em que atua. Guiados pelos princípios do Cristo à luz da Doutrina Espírita, desenvolvemos uma série de atividades religiosas e educacionais. Navegue pelo site e conheça um pouco mais do nosso trabalho!
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://nvinhadeluz.com" # the base hostname & protocol for your site
paginate: 3
paginate_path: "/blog/page:num/"

#Redes sociais
twitter_username:     Vinhadeluz1
facebook_username:    nucleovinhadeluz
instagram_username:   vinhadeluz
googleplus_username:  +Nvinhadeluzbh
youtube_username:     nucleovinhadeluz

# Build settings
markdown: kramdown
gems: [jekyll-paginate]
exclude: ["Gemfile", "Gemfile.lock"]
encoding: UTF-8

# Default settings
defaults:
  -
   values:
     comments: true

2 个答案:

答案 0 :(得分:0)

我的代码示例:

发布示例:

---
layout: post
title:  "Copasa visita Centro Pedagógico Vinha de Luz!"
date:   2015-11-12 17:40:27 -0200
categories: Notícias
author: Júlio
image: copasa-visita.jpg
---
Hoje o Vinha de Luz recebeu uma visita da Copasa (Companhia de Sanemanto de Minas Gerais) para uma aula sobre o uso consciente da água, e adivinhem só? Nossas crianças sabem tudo sobre o bom uso dos nossos recursos naturais! Deram um show!

Confira as fotos na galeria abaixo, e logo mais há um vídeo das crianças cantando junto com os instrutores!

帖子布局:

---
layout: default
---

{% assign author = site.data.authors[page.author] %}

<div class="wrapper" style="max-width:700px;">

<article class="post" itemscope itemtype="http://schema.org/BlogPosting">

  <header class="post-header">
    <h3 class="post-title" itemprop="name headline" style="font-           weight:bold;">{{ page.title }}</h3>
    <p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ author.name }}</span></span>{% endif %}
    {% include commentcount.html %}<!--Contador de comentários-->
    <span><a href="{{ page.url }}#disqus_thread"></a></span></p><!--Contador de Comentários-->
    <!-- Go to www.addthis.com/dashboard to customize your tools -->
    <div class="addthis_sharing_toolbox"></div>
  </header>


  <img src="{{ site.baseurl }}/imagens/{{ page.image }}" style="margin-bottom:50px;">



  <div class="post-content" itemprop="articleBody">
    {{ content }}


  <div style="margin-top:50px;">{% include author-box.html %}</div>
  </div>

</article>

<div style="padding-bottom:50px;">{% include disqus.html disqus_identifier=page.disqus_identifier %}</div>

</div>

我在Jekyll的核心中没有改变任何东西,而且这个bug从零开始。对不起,如果代码有点混乱,我还在学习如何在这里做事。

答案 1 :(得分:0)

我认为该问题必须与Jekyll依赖项之一相关,因此您需要一个依赖项管理器,例如Bundler

  1. 安装Bundler

    gem install bundler 
    

    sudo gem install bundler
    
  2. 添加Gemfile。导航到项目文件夹cd path/to/folder并运行:

    bundle init
    

    这将为您创建一个Gemfile,如下所示:

    # A sample Gemfile
    source "https://rubygems.org"
    
    # gem "rails"
    
  3. 在代码编辑器中编辑Gemfile

    如果您的网站由GitHub托管,请将其添加到您的Gemfile:

    source "https://rubygems.org" # or replace https for http if don't have OpenSSL installed locally
    
    gem 'github-pages'
    gem 'jekyll-paginate'
    # any other gem you use in your project
    

    如果您没有在GitHub上托管您的网站:

    source "https://rubygems.org"
    
    gem 'jekyll', '3.1.2' # or any other Jekyll version
    gem 'jekyll-paginate'
    # any other gem you use in your project
    
  4. 运行bundle install:这将处理您需要的所有gems,并在项目文件夹中添加Gemfile.lock

  5. 在您的_config.yml排除GemfileGemfile.lock的构建中:

    exclude: ["Gemfile", "Gemfile.lock"]
    
  6. 与Bundler一起为Jekyll服务:

    bundle exec jekyll serve
    

    您可以将所需的所有标志添加到此命令中,例如:

    bundle exec jekyll serve --watch -baseurl ""
    
  7. 完成!

    还有一件事:葡萄牙语有很多禁止的字符,因此,每次在Yaml前面使用áâã之类的内容时,请确保你这样做在""

    之间
    categories: "Notícias"
    author: "Júlio"
    

    那就是它!我想你应该没问题。

    请告诉我这是否有帮助,是吗? :)