時(shí)間:2023-09-28 06:36:01 | 來源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2023-09-28 06:36:01 來源:網(wǎng)站運(yùn)營(yíng)
用Hugo制作網(wǎng)頁P(yáng)PT:hugo_0.61.0_Windows-64bit.zip
或 hugo_extended_0.61.0_Windows-64bit.zip
(32位電腦請(qǐng)自覺用 32bit)hugo_*.exe
文件重命名為 hugo.exe
,并添加該文件所在目錄到 PATH 環(huán)境變量中,方便命令行訪問hugo help
來驗(yàn)證配置是否成功,成功時(shí)輸出會(huì)包括以下內(nèi)容:Hugo is a Fast and Flexible Static Site Generatorbuilt with love by spf13 and friends in Go.
hugo new site my-presentationcd my-presentation
如果安裝了 git 可以使用 git 安裝主題:git initgit submodule add git@github.com:dzello/reveal-hugo.git themes/reveal-hugo
否則需要在 dzello/reveal-hugos 下載 ZIP 文件,解壓到 my-presentation/themes/
并確保解壓出的文件夾名稱是 reveal-hugo
my-presentation
文件夾中的 config.toml
添加以下內(nèi)容:theme = "reveal-hugo"RelativeURLs = trueCanonifyURLs = true[markup]defaultMarkdownHandler = "blackfriday"[outputFormats.Reveal]baseName = "index"mediaType = "text/html"isHTML = true
最后,在 content
文件夾下,創(chuàng)建 _index.md
文件:+++title = "My presentation"outputs = ["Reveal"]+++# Hello world!This is my first slide.---# Hello Mars!This is my second slide.
上面 +++
框起來的區(qū)域用來寫網(wǎng)頁相關(guān)配置頭部信息。后面開始是正文內(nèi)容。my-presentation
目錄下執(zhí)行 hugo
命令。所有生成的靜態(tài)網(wǎng)站數(shù)據(jù)在 public
文件夾下,打開 index.html
來查看網(wǎng)站內(nèi)容。hugo server
命令,會(huì)有類似以下輸出(不要關(guān)閉這個(gè)窗口):Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
這時(shí)可以打開 http://localhost:1313/
即可實(shí)時(shí)預(yù)覽,當(dāng)文件有改動(dòng)時(shí),網(wǎng)頁會(huì)自動(dòng)刷新。- content - home # 特殊目錄,用于添加內(nèi)容到網(wǎng)站首頁 PPT 之后 - body.md # 添加到首頁 PPT 后 - conclusion.md # 添加到首頁 PPT 后 - _index.md # 網(wǎng)站首頁 PPT - ted-talk - _index.md # ted talk PPT 的開頭 - body.md # 添加到 ted talk PPT 后 - conclusion.md # 添加到 ted talk PPT 后
在這個(gè)目錄結(jié)構(gòu)中,最后會(huì)生成兩個(gè) PPT,一個(gè)是根目錄的 PPT,一個(gè)是 /ted-talk
路徑下的 PPT。在文件夾中的補(bǔ)充 Markdown 文件會(huì)按照其中配置頭部信息中的 weight
屬性排序。如:+++weight = 10+++# Slide 3---# Slide 4
---
空行隔開的 ---
表示分隔到下一頁 Slide。{{% section %}}# Vertical slide 1---# Vertical slide 2{{% /section %}}
{{% fragment %}} One {{% /fragment %}}{{% fragment %}} Two {{% /fragment %}}{{% fragment %}} Three {{% /fragment %}}
可以實(shí)現(xiàn)增量顯示,即開始不顯示,每次操作順次出現(xiàn)。{{% frag c="One" %}}
通過 c
屬性確定內(nèi)容,同上面的第一行。index
屬性來指定顯示的順序,如 {{% fragment index=2 %}} One {{% /fragment %}}
。生成的 html 如下:<span class='fragment' data-fragment-index=2> One </span>
data-fragment-index
屬性指定顯示順序,從小到大依次顯示,數(shù)值一樣則同時(shí)顯示。對(duì)于行內(nèi)文字用 <span>
包裹,而段(block
)內(nèi)容(如代碼塊、圖片)用 <div>
包裹。主題默認(rèn)沒有提供 <div>
類型的 shortcode,可以自己將 themes/reveal-hugo/layouts/shortcodes/fragment.html
復(fù)制到 layouts/shortcodes/bfragment.html
文件中,將其中的兩個(gè) span
換成 div
。之后用 {{% bfragment %}}
可以使段內(nèi)容增量顯示,而且同樣可以用 index
指定顯示順序。---{{< slide id="custom-slide" >}}## Custom slide---
id
屬性用來鏈接引用。如 [Try the link](#custom-slide)
會(huì)生成一個(gè)鏈接到對(duì)應(yīng) id
的 Slide 的鏈接。{{% note %}}
可以添加演講者注釋信息,在網(wǎng)頁端按 s
鍵可以打開演講者界面。static
目錄下創(chuàng)建 plugin
文件夾,將 reveal.js 的插件放入其中。在需要使用插件的 Markdown 文件頭部添加:[reveal_hugo]plugins = ["plugin/math-katex/math-katex.js"]slide_number = true
路徑要對(duì)應(yīng)實(shí)際的 js 文件。順便說一句,最后一行的 slide_number
為可選設(shè)置,它可以設(shè)置是否顯示 Slide 頁碼,取值 true
或 false
。layouts/partials/<path-to-slide>/reveal-hugo
目錄下添加 head.html
文件,加上引用所需 css 的 html 代碼。s
進(jìn)入演講者模式o
進(jìn)入概覽模式f
進(jìn)入全屏模式?print-pdf
,如 https://gkzhb.gitee.io/slides/?print-pdf
,然后使用 Chrome 的打印功能即可導(dǎo)出為 PDF。{{< markdown >}}
與用 html 渲染 Slide <section data-noprocess> ... </section>
exampleSite/content
目錄下可以看到演示 Demo 的源 Markdown 文件,可以作為參考樣例。public
文件夾放到 U 盤通過瀏覽器打開。簡(jiǎn)單的部署可以選擇 Github 或碼云(國(guó)內(nèi)推薦,網(wǎng)速更快)的靜態(tài)網(wǎng)站托管服務(wù)。關(guān)鍵詞:
客戶&案例
營(yíng)銷資訊
關(guān)于我們
客戶&案例
營(yíng)銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。