Web Notes
2016.08.20
Using Liquid in Jekyll - Live with Demos
Liquid is a simple template language that Jekyll uses to process pages for your site. With Liquid you can output complex contents without additional plugins.
HTML 初学者会经常遇到这样一个问题,如何正确引用一个文件(路径)。比如,怎样在一个 HTML 网页中引用另外一个本地 HTML 网页作为超链接(hyperlink),怎样在一个网页中插入一张图片。如果你在引用文件时(如加入超链接,或者插入图片等),使用了错误的文件路径,就会导致引用失效(无法浏览链接文件,或无法显示插入的图片等)。
为了避免这些错误,正确地引用文件,我们需要学习一下 HTML 路径。
HTML 有两种路径的写法:相对路径和绝对路径。
如果源文件和引用文件在同一个目录里,直接写引用文件名即可。
我们现在建一个源文件 info.html,在 info.html 里要引用 index.html 文件作为超链接。
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\sites\blabla\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="index.html">index.html</a>
../ 表示源文件所在目录的上一级目录,../../ 表示源文件所在目录的上上级目录,以此类推。
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\sites\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="../index.html">index.html</a>
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="../../index.html">index.html</a>
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\sites\wowstory\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="../wowstory/index.html">index.html</a>
引用下级目录的文件,直接写下级目录文件的路径即可。
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\sites\blabla\html\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="html/index.html">index.html</a>
假设 info.html 路径是:c:\Inetpub\wwwroot\sites\blabla\info.html
假设 index.html 路径是:c:\Inetpub\wwwroot\sites\blabla\html\tutorials\index.html
在 info.html 加入 index.html 超链接的代码应该这样写:
<a href="html/tutorials/index.html">index.html</a>
HTML 绝对路径指带域名的文件的完整路径。
例如我有一个域名 frankindev.com,那么这个域名就是网站的根目录。
假设在根目录下放了一个文件 index.html,这个文件的绝对路径就是: https://frankindev.com/index.html。
假设在根目录下建了一个目录叫 html_tutorials,然后在该目录下放了一个文件 index.html,这个文件的绝对路径就是 https://frankindev.com/html_tutorials/index.html 。
以上。
Frank Lin
PREV
Web Notes
2016.08.20
Liquid is a simple template language that Jekyll uses to process pages for your site. With Liquid you can output complex contents without additional plugins.
Web Notes
2017.03.18
By default, Jekyll 3 and versions above integrated with Rouge, a pure Ruby syntax highlighter which supports over 100 languages. Since Rouge themes are compatible with Pygments's stylesheets, it’s nice for us to choose a favourable style.
Tools
2022.05.23
It's time to add a new plugin for my Jekyll site to support emojis, with a convenient and consistent way. Also a cheat sheet list for available emojis in GitHub flavoured Markdown documents using JoyPixels icons is presented.
玉烛新·白海棠
初晴新雨后。
乍洗褪胭脂,缟衣妆就。东风倦倚,憨憨态、不管敲残更漏。嫩寒天气,正睡稳、乌衣时候。深夜静、银烛高烧,微香暗侵襟袖。
盈盈一点芳心,占多少春光,问卿知否?红妆莫斗。
谁得似、净骨天然清瘦。神娟韵秀。雅称个、花仙为首。还要倩、流水高山,花前慢奏。