github页面上的jekyll有不正确的src(例如“http:// localhost:4000 / assets / js / scripts.min.js”)

问题描述 投票:0回答:2

我的项目:https://github.com/sebastian3495/sebastian3495.github.io我的网站(当前显示没有css呈现):https://sebastian3495.github.io/

如何让所有链接指向我的github项目而不是localhost?

我错过了什么?我是jekyll的新手,网络开发不是我的最强点,所以请耐心等待。

编辑:我的配置文件已更新

_config.yml

title:            Blog Title
description:      Describe your website here.

# put your disqus here
remote_theme: aron-bordin/neo-hpstr-jekyll-theme
disqus_shortname:
reading_time:     true # if true, shows the estimated reading time for a post
words_per_minute: 200
logo:             images/logo.png # logo visible in the topbar
excerpt_separator: <!--more-->
url: https://sebastian3495.github.io




# draw your top menu here
# each item must have a title and a url.
#   To list post categories. use type: 'categories'
#   To create sub categories. add a submenu item
# See the example
menu:
  - title: 'Home'
    url: '/'
  - title: 'Fork'
    url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme'
  - title: 'Install'
    url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme#installation'
  - title: 'Tags'
    url: '/tags'
  - title: 'Categories'
    url: '/categories'
    type: 'categories'
  - title: 'Favorites'
    url: '#'
    submenu:
      - title: 'Code Highlighter'
        url: '/intro/code-highlighting-post/'
      - title: 'Sample Post'
        url: '/intro/sample-post/'

# Owner/author information
owner:
  name:           Sebastian Nielsen
  site:           http://aronbordin.com
  avatar:         images/avatar.jpg
  bio:            "TEsting stuff off! . :D . It shouldn't be super long but a good two sentences or two should suffice."
  email:          [email protected]
  # Twitter nick for use in Twitter cards and follow button.
  twitter: aron_bordin # if no twitter in this config, the twitter follow button will be removed
  # GitHub nick for use in follow button in author block.
  github: aron-bordin

# Twitter account associated with the site if different from owner/author twitter account.
# Used in Twitter cards.
twitter:

# Social networking links used in author block underneath posts. Update and remove as you like.
social:
  - title: "github"
    url: "https://github.com/aron-bordin"
  - title: "linkedin"
    url: "https://br.linkedin.com/in/aronbordin"
  - title: "youtube"
    url: "https://www.youtube.com/channel/UCfnSek-9HPWOx5e2pH7VFgg"

# Background image to be tiled on all pages
background:

# Analytics and webmaster tools stuff goes here
google_analytics:
google_verify:
# https://ssl.bing.com/webmaster/configure/verify/ownership Option 2 content= goes here
bing_verify:

# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone:    America/New_York
locale:      en_US
future:      true
highlighter: rouge
markdown:    kramdown
sass:
  sass_dir: _sass
  style: compressed

# https://github.com/mojombo/jekyll/wiki/Permalinks
permalink:   /:categories/:title/

# Amount of post to show on home page
paginate: 5

# if true, shows the floatting share buttons
float_share: true

# Octopress
# Default extensions
post_ext: md
page_ext: md
# Found in _templates/
post_layout: post
page_layout: page
# Format titles with titlecase?
titlecase: true

include: [".htaccess", "C:/Users/sebas/Documents/GitHub/Sebastian_Nielsen_Blog/_includes"]
exclude: ["demo/*", "lib", "config.rb", "Capfile", "config", "Gemfile", "Gemfile.lock", "README.md", "LICENSE", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"]
plugins: ["jekyll-paginate", "jekyll-remote-theme"]
theme: neo-hpstr-jekyll-theme
github jekyll
2个回答
0
投票

由于您使用的是第三方主题,因此我了解您按照说明在本地运行jekyll build,然后上传了./_site目录的内容。

这里的问题是,当你在本地构建时,最新版本的Jekyll会自动将url密钥设置为http://localhost:4000

您有两个基本选择:

  1. 要在GitHub页面上同时使用第三方主题和第三方插件,您需要通过将JEKYLL_ENV env更改为production(或除development之外的任何其他内容)在本地构建网站 JEKLL_ENV=production bundle exec jekyll build (在Windows上,你需要首先运行set JEKLL_ENV=production,然后运行jekyll咒语。
  2. 要使用仅需要官方插件的第三方主题,并且主题回购本身也在GitHub上托管,您可以使用remote_theme功能(默认包含在最新版本的gem "github-pages"中): # _config.yml remote_theme: aron-bordin/neo-hpstr-jekyll-theme 有关https://github.com/benbalter/jekyll-remote-theme插件使用的详细信息,请参阅:jekyll-remote-theme

0
投票

在推送本地生成的代码时,您需要:

  • 在_config.yml中,url: https://sebastian3495.github.io设置
  • 运行bundle exec jekyll build
  • 将生成的代码推送到github。
© www.soinside.com 2019 - 2024. All rights reserved.