这是我目前用来查看博客文章是否超过 120 个字的代码片段。如果为 true,请截断内容并在帖子底部添加“阅读更多”链接。
<div class="blogs">
{% for post in site.posts %}
<article class="post">
<h3><a href="{{ site.baseurl }}/{{ site.blogs }}{{ post.title }}">{{ post.title }}</a></h3>
{% assign wordCount = {{ post.content | size }} %}
{% if wordCount > 120 %}
<div class="entry">
{{ post.content | truncatewords:120}}
</div>
<a href="{{ site.baseurl }}{{ post.url}}" class="read-more">Read More</a>
{% else %}
{{ post.content }}
{% endif %}
</article>
{% endfor %}
</div>
Run Code Online (Sandbox Code Playgroud)
当我提交这个时,我收到一封来自 GitHub 的电子邮件,说构建时出现页面错误,并且没有打印出任何其他内容。
我猜这与{{ post.content }}无法过滤掉尺寸有关,所以我被卡住了。
我如何获得单个博客文章的字数,以便我能够截断一些超过 120 个字的文章?提前致谢。
我在 github pages 站点上使用 Jekyll。有几个代码块显示在<pre>块中,并作为工作代码包含在演示页面中。为此,我在_includes 中提取了这些块。
可以说,我们在_includes文件夹中有basic.html。
现在我将它作为工作代码包含在演示页面上:
{% include demos/basic.html %}
Run Code Online (Sandbox Code Playgroud)
我需要在<pre>标签中包含此代码。
<pre class="prettyprint lang-html">{% include demos/basic.html %}</pre>
Run Code Online (Sandbox Code Playgroud)
在这里,我在 .html 标签中遇到了问题<pre>。他们应该逃脱。我xml_escape在 Jekyll 中找到了过滤器,但它不能应用于包含。
有人可以建议我如何应对吗?
我已经遵循了将自定义域定向到 Github 端和 DNS 端的 Github 项目页面的所有指南。该项目的 Github Pages 托管在自定义域之前工作,但现在要么没有任何作用,要么只是正常的 Github Pages 工作,而不是自定义域。
我试过移动一切,重命名CNAME文件,一切都有时间传播,它应该可以工作,但我不知道该怎么做。我试过把CNAME文件放在master分支和gh-pages分支中。我尝试CNAME在文件中手动设置或在 repo 设置中自动设置。这一切都无济于事。
我可以说它应该可以工作,因为当我访问自定义域时,它肯定指向 Github,因为它返回一个 404,没有找到页面。
我想使用 Lib 本身为 GitHub 上的 JS Lib 编写一些文档。我创建了一个名为的空分支gh-pages并开始构建文档页面。现在我需要使用我正在记录的 Lib 编写一些 Javascript,因为谁不会使用他们自己的库。我尝试通过安装它,npm install但显然出现了这个错误:
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "package" under a package
npm ERR! also called "package". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
Run Code Online (Sandbox Code Playgroud)
那么如何gh-pages在不从主分支复制的情况下将代码库放入我的-branch 中呢?我不想在两个不同的分支中维护相同的代码库。
我做了一个简单的Angular 5封面,说我还在构建这个网站.
ng serve工作正常,局部的,但现在我想举办这次对我校的网站在这里和我没有发现这些404个资源,我所做的就是副本什么在运行后DIST /文件夹ng build --prod,以在Web服务器上的WWW /文件夹.
这个cli版本的角度为5:
"@angular/cli": "~1.7.1",
"@angular/compiler-cli": "^5.2.0",
Run Code Online (Sandbox Code Playgroud)
我试图将另一个推送到github-pages,这有同样的问题githubpages repo是repo但它几乎是一个空的回购.
所以我在 github 页面上设置了一个自定义域,一天前在 namecheap 上没有问题。然后我尝试通过 github 新添加的对页面上 https 的支持切换到 Https。在经历了太多的挫折之后,我切换到 CloudFlare for Https,但我现在收到一个错误ERR_TOO_MANY_REDIRECTS
这是我在 CloudFlare 上的 DNS 设置。
我正在将我的 vue-app 部署到 gh-pages 并面临加载背景图像的问题。
这是我的项目的结构
而这里链接到我的项目上GH-页面生活。
您可以看到来自 img 标签的图像正在加载,svg 文件也在加载,但不是 svg 的背景图像没有(我所有的背景图像都在 img 文件夹中)。
我可以在控制台中看到哪些路径搞砸了——它们应该是,static/img/footer.88ceaa2.png但它们是static/css/static/img/footer.88ceaa2.png
我的组件中的背景路径应该不同还是我的配置文件中的某些内容?任何帮助都感激不尽。
重新加载发布在 gh 页面上的 angular 应用程序时,我收到错误消息。错误是:
404
File not found.
The site configured at this address does not contain the requested file.
Run Code Online (Sandbox Code Playgroud)
我已经使用 ng build --prod 构建了我的应用程序。
Github 存储库: https : //github.com/chirag299051/IceAndFire
Github 页面: https : //chirag299051.github.io/IceAndFire/
我的 app.module.ts 文件包含:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { RouterModule, Routes } from '@angular/router';
import { BookDetailsComponent } …Run Code Online (Sandbox Code Playgroud) 有人知道是否可以将 Angular Universal 部署到 Github Pages?有像angular-cli-ghpages这样的解决方案,但 IIUC 这些不会为 SEO 预渲染内容。
javascript github-pages typescript angular-universal angular
我刚刚将一个 Angular 8 项目部署到我的 Github 存储库,但 Github 页面上没有显示任何内容,但我在浏览器控制台上看到一个错误。
在 Firefox 上,错误说:
Loading module from “https://theotherspace.illiteratibooksandcoffee.com/theotherspace/runtime-es2015.27965c48d77c449cb93c.js” was blocked because of a disallowed MIME type (“text/html”).
在 Chrome 上:
Failed to load resource: the server responded with a status of 404 ()
以下是截图:
github-pages ×10
angular ×4
github ×3
jekyll ×2
npm ×2
cloudflare ×1
cname ×1
conventions ×1
dns ×1
hosting ×1
html ×1
javascript ×1
liquid ×1
markdown ×1
ng-build ×1
nginx ×1
reactjs ×1
typescript ×1