2017-01-06 9 views
6

मैं _site फ़ोल्डर उत्पन्न करने के लिए bundle exec jekyll build && bundle exec jekyll serve --watch चला रहा हूं, जिसे हम फिर वेब सर्वर पर एफ़टीपी द्वारा अपलोड करते हैं। _site फ़ोल्डर में index.html फ़ाइल में सही साइट यूआरएल के बजाय "लोकलहोस्ट" स्थानीय यूआरएल के लिंक शामिल हैं, जिसके परिणामस्वरूप टूटी हुई लिंक हैं। एफ़टीपी के साथ तैनाती का मतलब है कि लिंक का पाठ उत्पादन सर्वर के रूप में तैनात किया जाएगा, और उपयोगकर्ताओं को हमारे ब्लॉग यूआरएल के बजाय "लोकलहोस्ट" पर रीडायरेक्ट किया जाएगा। मैं इसे कैसे ठीक करूं? मुझे पहले किसी भी समस्या का सामना नहीं हुआ है। index.html सेजैकिल बिल्ड _site (उत्पादन) फ़ाइलों में 'लोकलहोस्ट' लिंक डाल रहा है

अंश:

<link rel="stylesheet" type="text/css" href="/blog/slick/slick.css"/> 
    <link rel="stylesheet" type="text/css" href="/blog/slick/slick-theme.css"/> 
    <link rel="stylesheet" href="/blog/css/main.css"> 
    <link rel="canonical" href="http://localhost:4000/blog/"> 
    <link rel="alternate" type="application/rss+xml" title="The WordBrewery Blog | Language Untapped" href="http://localhost:4000/blog/feed.xml"> 

_config.yml से अंश:

title: "The WordBrewery Blog | Language Untapped" 
description: "WordBrewery's home for aspiring polyglots. Study tips, book and app reviews, grammar and vocabulary lessons, interviews, and other language-learning resources." 
baseurl: "/blog" # the subpath of your site 
url: "https://wordbrewery.com" # the base hostname & protocol for your site 
feed: <link rel="alternate" type="application/rss+xml" title="{{ site.name }}" href="{{ site.url }}/feed.xml" target="_blank"> 
wordbrewery: "[WordBrewery](http://wordbrewery.com){:target='_blank'}" 
languages-offered: "twenty" 

# Jekyll settings 

markdown: kramdown 
permalink: /:categories/:title/ 
gems: [jekyll, jekyll-archives, github-pages, bundler, bourbon, neat, jekyll-seo-tag, classifier-reborn, jekyll-feed, nokogiri, jekyll-sitemap, "jekyll/figure"] 
encoding: utf-8 
lsi: true 
timezone: America/Denver 
logo: "{{ site.url }}/assets/images/logo-gold.jpg" 
avatar: "{{ site.url }}/assets/images/fb-profile.jpg" 
locale: "en_US" 

# YAML defaults 

defaults: 
    scope: 
     path: "" # an empty string here means all files in the project 
    values: 
     layout: post 
     title: "WordBrewery now has native-speaker audio for beginning Spanish" 
     author: "WordBrewery" 
     category: Learning 
     image: SpanishSpain.jpg 
     featured: true 
    sass: 
     sass_dir: _sass 
+0

कोई जेकिल कोड के साथ, डीबग करना मुश्किल है। कोई भंडार यूआरएल? या शायद '_ शामिल/head.html' सामग्री। –

उत्तर

8

तुम सिर्फ अपनी साइट बनाने की जरूरत है (स्थानीय स्तर पर यह सेवा करने के लिए नहीं) तो फिर आप अपलोड कर सकते हैं जेनरेट की गई फाइलें आपके सर्वर पर:

$ bundle exec jekyll build 

जो कॉन के मूल्य के साथ कैनोलिक लिंक उत्पन्न करेगा _config.yml में मूर्तिकला परिवर्तनीय url

<link rel="canonical" href="https://wordbrewery.com/blog/"> 

आप Jekyll के serve आदेश चला, तो यूआरएल के मूल्य localhost होगी, क्योंकि इसका लक्ष्य अपने Jekyll एप्लिकेशन डिबग करने के लिए एक स्थानीय उदाहरण की सेवा के लिए है।

<link rel="canonical" href="http://localhost:4000/blog/"> 

या और भी बेहतर environment चर के रूप में उत्पादन को निर्दिष्ट ताकि आप डिफ़ॉल्ट रूप से Jekyll environmnet चर के विकास सेट वातावरण जहां आप कर रहे हैं पर निर्भर करता है कोड के कुछ हिस्सों को निष्पादित करने के लिए चुन सकते हैं,:

:

$ JEKYLL_ENV=production bundle exec jekyll build 

फिर अपने कोड में आप की तरह कुछ डाल सकते हैं

{% if jekyll.environment == "production" %} 
    {% include adsense.html %} 
{% endif %} 
0

की तरह एक बाद की तारीख में इस पर पहुंचने लोगों के लिए अपने आप को-मैंने पाया jekyll build आईएनजी जबकि मैं एक ही समय स्थानीय होस्ट करने के लिए नेतृत्व पर ing किसी अन्य प्रक्रिया jekyll serve था कि html फ़ाइलें में undesirably शामिल किया जा रहा।

अन्य serve प्रक्रिया को रद्द करने से पहले मेरे लिए काम किया गया।

संबंधित मुद्दे