首页 文章

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

提问于
浏览
0

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

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

我'm running Jekyll on Ubuntu 15.10, and I' m试图更新这个网站: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

    我的代码示例:

    发布示例:

    ---
    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从零开始 . 对不起,如果代码有点乱,我还在学习如何在这里做事 .

  • 0

    我认为这个问题必须与Jekyll依赖项之一有关,所以你需要一个依赖管理器,比如Bundler .

    • 安装Bundler
    gem install bundler
    

    要么

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

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

    # A sample Gemfile
    source "https://rubygems.org"
    
    # gem "rails"
    
    • 在代码编辑器中编辑 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
    
    • 运行 bundle install :这将处理您需要的所有 gems 并将 Gemfile.lock 添加到项目文件夹中 .

    • 在您的 _config.yml 排除 GemfileGemfile.lock 来自版本:

    exclude: ["Gemfile", "Gemfile.lock"]
    
    • 与Bundler一起为Jekyll服务:
    bundle exec jekyll serve
    

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

    bundle exec jekyll serve --watch -baseurl ""
    

    完成!

    还有一件事:葡萄牙语有很多禁止的字符,因此,每次你在Yaml前面使用 áâã 之类的东西时,请确保在_1780741之间执行此操作:

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

    而已!我想你应该没问题 .

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

相关问题