創建hugo博客_Hugo + Firebase:如何在幾分鐘內免費創建自己的靜態網站

創建hugo博客

by Aravind Putrevu

通過Aravind Putrevu

Hugo + Firebase:如何在幾分鐘內免費創建自己的靜態網站 (Hugo + Firebase: How to create your own static website for free in minutes)

Ever thought of having your own website for putting up your project portfolio or resume or a blog for yourself. By the end of this article, you will be able to create one.

曾經想過要擁有自己的網站來發布項目組合或簡歷,或者自己創建一個博客。 在本文末尾,您將能夠創建一個。

Generally, to develop a website you need to know HTML, CSS, and a bit of JavaScript (sometimes). But, for this, you don’t need to have any coding skills. You just need basic computer skills.

通常,要開發網站,您需要了解HTML,CSS和一些JavaScript(有時)。 但是,為此,您不需要任何編碼技能。 您只需要基本的計算機技能。

To put up a website, you need to have a “space” (aka hosting) where all your files will be uploaded. Whenever someone types your website and clicks enter, these are the files that are served/presented to the user on the browser.

要建立一個網站,您需要有一個“空間”(又名托管),所有文件都將被上傳到該空間。 每當有人鍵入您的網站并單擊Enter時,這些文件就會在瀏覽器上提供/呈現給用戶。

Let’s get started with what you need to have/know:

讓我們開始了解您需要具備/知道的內容:

Google帳號 (Google Account)

I believe you might already have a Gmail account, which is enough. If not create one.

我相信您可能已經有一個Gmail帳戶,這就足夠了。 如果沒有創建一個。

(Domain)

This is optional. There are various domain name providers in the world, additionally you can buy one at Google. You can find a list of domain name providers. It is as simple as shopping on Amazon.

這是可選的。 世界上有各種各樣的域名提供商,此外,您可以從Google購買一個。 您可以找到域名提供商的列表。 就像在亞馬遜上購物一樣簡單。

雨果 (Hugo)

Hugo is a Go language-based tool, which generates static websites. You can use various templates and make different types of websites like blogs, portfolio sites etc.

Hugo是一種基于Go語言的工具,可以生成靜態網站。 您可以使用各種模板并創建不同類型的網站,例如博客,投資組合網站等。

Download it from here.

從這里下載。

火力基地 (Firebase)

Firebase is a mobile and web application platform, acquired by Google a few years ago. Firebase offers hosting as one of its features. However, many mobile developers use it for Analytics, Notifications, Crash Reporting of apps. We are going to use it for hosting our website.

Firebase是一個移動和Web應用程序平臺,幾年前被Google收購。 Firebase將托管作為其功能之一。 但是,許多移動開發人員將其用于應用程序的分析,通知和崩潰報告。 我們將使用它來托管我們的網站。

Node.js (Node.js)

Node.js is an open-source JavaScript run time built on Chrome’s V8 JavaScript engine. For this tutorial, you need it to be installed on your machine for Firebase tools to work. You can download and install it from here.

Node.js是基于Chrome的V8 JavaScript引擎構建的開源JavaScript運行時。 對于本教程,您需要將其安裝在計算機上以使Firebase工具正常工作。 您可以從此處下載并安裝它。

第1步:在計算機上安裝Hugo (Step 1: Install Hugo on your machine)

Windows: You will get a simple portable executable file. You can place it anywhere and run via command line. You can add it to your path variable in Windows environment variables to get it referenced anywhere.

Windows:您將獲得一個簡單的可移植可執行文件。 您可以將其放置在任何地方并通過命令行運行。 您可以將其添加到Windows環境變量中的path變量中,以在任何地方引用它。

Mac: You can install it using Homebrew. If you don’t have brew installed on your mac, you can download the tarball from here.

Mac:您可以使用Homebrew安裝它。 如果您的Mac上未安裝Brew,則可以從此處下載壓縮包。

Either way, make sure you are able to access Hugo by giving below command.

無論哪種方式,請通過以下命令確保您能夠訪問Hugo。

步驟2:創建模板站點 (Step 2: Create a template site)

Head over to the location where you have decided to create your website and enter the command below:

轉至您決定創建網站的位置,然后在下面輸入命令:

$ hugo new site <path_to_folder>

At the given location you can see a folder structure as shown in below image.

在給定的位置,您可以看到一個文件夾結構,如下圖所示。

These folders are just placeholders for your content. All the text content of your site goes to content folder.

這些文件夾只是您內容的占位符。 您網站的所有文本內容都轉到內容文件夾。

You can run below commands to add new files.

您可以運行以下命令來添加新文件。

$ hugo new about.md

If you want to add a blog post create a folder named “blog” in “content” folder and start adding your files. These files have an extension of “.md” which are Markdown files.

如果要添加博客文章,請在“內容”文件夾中創建一個名為“ 博客 ”的文件夾,然后開始添加文件。 這些文件的擴展名為“ .md” ,它們是Markdown文件。

Markdown is a plain text formatting markup language. It is pretty and easy. There are umpteen guides on how to approach Markdown, here is one.

Markdown是純文本格式的標記語言。 既簡單又漂亮。 有許多關于如何使用Markdown的指南,這里是其中之一 。

步驟3:為網站設置主題 (Step 3: Set a theme for the site)

Hugo has a great community. Their themes site is enriched with different categories of website themes. Head over to it and select a theme, that suits your requirement.

雨果有一個很棒的社區。 他們的主題網站充斥著不同類別的網站主題。 轉到它并選擇一個適合您需求的主題。

I chose the Introduction theme. Clicking the download button will redirect to GitHub.

我選擇了簡介主題。 單擊下載按鈕將重定向到GitHub 。

Each theme will have its own way of setting things up. This particular theme doesn’t have many steps. Just clone or download the zip to the themes folder. Copy the config.toml file to the root folder of your website.

每個主題都有其自己的設置方式。 這個特定主題沒有很多步驟。 只需將zip克隆或下載到themes文件夾即可。 將config.toml文件復制到網站的根文件夾。

步驟4:設定偏好設定 (Step 4: Set up your preferences)

Open the config.toml file and start editing it. Give your name and other details you wish to show up on the website. Some themes support Google Analytics so that you can track the user visit count etc. You can give your GA Id to gather data.

打開config.toml文件并開始對其進行編輯。 輸入您希望顯示在網站上的名稱和其他詳細信息。 某些主題支持Google Analytics(分析),因此您可以跟蹤用戶訪問次數等。您可以給您的GA ID收集數據。

第5步:設置Firebase托管項目 (Step 5: Set up a Firebase Hosting Project)

As I mentioned earlier, Firebase is a beautiful mobile platform with a ton of features. I used Firebase hosting to host my static website generated via Hugo.

如前所述, Firebase是具有許多功能的漂亮移動平臺。 我使用Firebase托管來托管通過Hugo生成的靜態網站。

To use Firebase services use your Google account and login to Firebase website.

要使用Firebase服務,請使用您的Google帳戶并登錄到Firebase網站 。

Click on “Go to console.” Create a project by giving it a name. You will be shown an overview page in which you should select “getting started on Hosting.”

點擊“轉到控制臺”。 通過命名來創建一個項目。 系統將顯示一個概述頁面,您應在其中選擇“ 主機托管入門”。

第6步:在計算機上設置Firebase工具 (Step 6: Set up Firebase tools on your machine)

Open your terminal/command line interface on your machine and type command below.

在計算機上打開終端/命令行界面,然后在下面鍵入命令。

$ npm install -g firebase-tools

The above command installs the Firebase-tools package. You need to execute a few more commands to be able to deploy your website directly.

上面的命令將安裝Firebase-tools軟件包。 您需要執行更多命令才能直接部署您的網站。

$ firebase login

This command connects your machine to the Firebase project. It enables you to list and select the project to which you want to push your changes.

此命令將您的計算機連接到Firebase項目。 它使您可以列出并選擇要推送更改的項目。

$ firebase list

You can run above command to see the project which you have created. One final touch to the entire workflow, we need to initialize the root folder of your website as Firebase project root.

您可以運行以上命令來查看已創建的項目。 最后,要完成整個工作流程,我們需要將您網站的根文件夾初始化為Firebase項目根目錄。

$ firebase init

It will ask you some questions like

它會問你一些問題,例如

  • Which Firebase CLI features do you want to setup? Answer: Hosting.

    您要設置哪些Firebase CLI功能? 答:托管。
  • Select a default Firebase project for this directory Answer: Select Firebase project you have created in Step 5.

    為該目錄選擇默認的Firebase項目答案:選擇在步驟5中創建的Firebase項目。
  • Do you want to use as your public directory? Answer: Yes.

    您想用作公共目錄嗎? 答:可以。
  • Configure as a single-page app? Answer: Yes.

    配置為單頁應用程序? 答:可以。

To avoid confusion, I have detailed screenshots taken at each step for your reference. It can be downloaded here.

為避免混淆,我在每個步驟中都拍攝了詳細的屏幕截圖供您參考。 可以在這里下載。

Finally! Firebase initialization is complete.

最后! Firebase初始化完成。

步驟7:在本地驗證您的網站 (Step 7: Verify your website locally)

Run below command to check your site locally on your machine.

運行以下命令以在計算機上本地檢查您的站點。

$ hugo server -w

Hugo comes with a light-weight high-performance web server, where you can check all your changes. Make sure that all your images are put up in static/img folder. In an iterative process, change your config.toml and verify those on browser. Below is the port on which your server will be running.

Hugo帶有輕量級高性能Web服務器,您可以在其中檢查所有更改。 確保所有圖像都放在static / img文件夾中。 在迭代過程中,更改config.toml并在瀏覽器上進行驗證。 下面是服務器將在其上運行的端口。

http://localhost:1313

步驟8:部署網站 (Step 8: Deploy your website)

Type in below command to generate your site and push it to corresponding Firebase project which you have configured in Step 5.

在下面的命令中鍵入以生成您的站點并將其推送到您在步驟5中配置的相應Firebase項目。

$ hugo && firebase deploy

步驟9:將其連接到您的域(可選) (Step 9: Connect it to your domain (optional))

Firebase provides an option to connect your domain to Firebase app. Click on connect domain and give your domain and add the TXT records to verify your domain ownership.

Firebase提供了將您的域連接到Firebase應用程序的選項。 單擊連接域并提供您的域,然后添加TXT記錄以驗證您的域所有權。

For this log on to your domain registrar portal.

為此,請登錄您的域名注冊商門戶。

步驟10:建立網志文章 (Step 10: Create a blog post)

Creating a blog post is pretty simple. Hugo understands markdown files. Just head over to content->blog folder (folder location depends on the theme). Create a markdown file. Repeat the Step 8 to see the results.

創建博客文章非常簡單。 雨果了解markdown文件。 只需轉到content-> b日志文件夾(文件夾位置取決于主題)。 創建一個降價文件。 重復步驟8以查看結果。

If you have any queries or doubts, you can DM me on twitter !

如果您有任何疑問或疑問,可以在Twitter上給我發消息 !

Always Happy to help!

隨時樂意為您服務!

翻譯自: https://www.freecodecamp.org/news/hugo-firebase-how-to-create-your-own-dynamic-website-for-free-in-minutes-463b4fb7bf5a/

創建hugo博客

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/395074.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/395074.shtml
英文地址,請注明出處:http://en.pswp.cn/news/395074.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

探測與響應是各企業機構在2017年的首要安全事務

作者系&#xff1a;Gartner首席研究分析師 Sid Deshpande &Gartner研究總監 Lawrence Pingree 2017年&#xff0c;各個企業正在改變其安全支出戰略&#xff0c;從僅注重防御轉而更加關心探測和響應程度。2017年的全球信息安全支出預計將達到900億美元&#xff0c;相較2016年…

java怎么引入html文件路徑_如何在public_html中讀取文件但在域外?使用相對路徑...

我正在嘗試從我的(附加組件)域目錄之外的目錄中讀取文件 . 這是我的目錄結構&#xff1a;public_html /domain /file_read.phpfile_write.phpsensitive /file.dat雖然我能夠使用“../sensitive/file.dat”寫入敏感&#xff0c;但我無法使用相同的方法進行讀取 . 有什么想法嗎&a…

JS基本概念(3)

【5】操作符 &#xff08;1&#xff09;一元操作符&#xff1a;只能操作一個值的操作符 遞增、遞減操作符a --a 前置    a a-- 后置&#xff08;這四個操作符對任何值都適用&#xff0c;不能轉換成數字的轉換為NaN&#xff09; 一元加、一元減操作符&#xff0…

csv文件怎么轉成excel_Java讀寫excel,excel轉成json寫入磁盤文件

pom讀寫excel主要的dependency<dependency> <groupId>org.apache.poigroupId> <artifactId>poiartifactId> <version>3.16version> dependency> <dependency> <groupId>org.apache.poigroupId> …

如何用Ant Design Pro框架做項目省力

1、熟悉React所有語法&#xff0c;以及redux、redux-saga、dva、一類的庫的能力 2、靈活運用該框架提供的基礎UI組件&#xff0c;想方設法利用現有的UI組件進行組合&#xff0c;盡可能減少工作量 轉載于:https://www.cnblogs.com/ww01/p/10430553.html

通過在Chipotle用餐了解模板方法設計模式

by Sihui Huang黃思慧 通過在Chipotle用餐了解模板方法設計模式 (Understanding the Template Method design pattern by eating at Chipotle) Object-Oriented Design Patterns in Life— gain an intuitive understanding of OO design patterns by linking them with real-…

Coriant助力Aureon部署100Gbps光纖網絡

根據相關消息顯示&#xff0c;光傳輸設備廠商Coriant日前表示已經向網絡傳輸和業務通信服務供應商Aureon Technology提供了7100納米分組光傳輸平臺&#xff0c;幫助其進行100Gbps光纖網絡的拓展。 該服務供應商&#xff08;Aureon&#xff09;將利用該分組光傳輸系統&#xff0…

python class tynu()_Visual Studio Express | Teraz Visual Studio Community

Program Visual Studio 2019 jest teraz dost?pnyDostosowany instalatorTwrz aplikacje w technologiach WPF, WinForms, platformy uniwersaln? systemu Windows, Win32, Android, iOS i innych — wszystko to za pomoc? jednego ?rodowiska IDE zapewniaj?cego wszyst…

css樣式中如何設置中文字體?

代碼如下: .selector{font-family: SimHei,"微軟雅黑",sans-serif;} 注意&#xff1a;加上中文名“微軟雅黑”是為了兼容opera瀏覽器&#xff0c;中文字體名必須加上引號&#xff08;單引號雙引號都可以&#xff09;。 MicrosoftJhengHei為微軟正黑體&#xff0c;STH…

前端做CRM管理系統是做什么_代辦行業的CRM客戶關系管理系統應該是什么樣子的?...

隨著互聯網的深耕細化&#xff0c;很多企業也在不斷優化自己的辦公方式&#xff0c;以優化企業的辦公流程&#xff0c;提高企業的辦事效率。因此實現辦公自動化&#xff0c;或者說實現數字化辦公就需要逐漸提上日程。今天給大家講講可以幫助代辦行業實現辦公自動化的產品&#…

(譯) JSON-RPC 2.0 規范(中文版)

http://wiki.geekdream.com/Specification/json-rpc_2.0.html 起源時間: 2010-03-26(基于2009-05-24版本) 更新: 2013-01-04 作者: JSON-RPC工作組< json-rpcgooglegroups.com > 原文鏈接: http://www.jsonrpc.org/specification翻譯: leozvc < xxfs91gmail.com >…

ios pusher使用_如何使用JavaScript和Pusher實時更新用戶狀態

ios pusher使用by Rahat Khanna通過拉哈特漢娜 如何使用JavaScript和Pusher實時更新用戶狀態 (How to update a User’s Status in realtime using JavaScript and Pusher) “Hey, what’s up?” is not a phrase we need to ask someone these days. These days knowing wha…

python + pyqt5 UI和信號槽分離方法

初級菜鳥&#xff0c;知識點記錄。 每次重新生成UI.py文件的時候&#xff0c;里面的按鈕方法都會被清除&#xff0c;想一個方法可以把按鈕響應方法放到外面&#xff0c;利于維護。 新建一個按鈕文件并繼承UI代碼&#xff0c;把信號槽及按鈕響應方法寫在按鈕文件里面&#xff0c…

學習之路~sqh

推薦博客 Edison Chou&#xff1b;Vamei&#xff1b;算法?面試專題 - 簡書&#xff1b;xingoo - 博客園&#xff1b;設計模式 極速理解設計模式系列【目錄索引】- Caleung&#xff1b;Net設計模式 - 靈動生活&#xff1b;宅男程序員給老婆的計算機課程系列&#xff1b;C設計模…

python format函數保留兩位小數_python format函數

在Python 3.0中&#xff0c;%操作符通過一個更強的格式化方法format()進行了增強。對str.format()的支持已經被反向移植到了Python 2.6在2.6中&#xff0c;8-bit字符串和Unicode字符串都有一個format()方法&#xff0c;這個方法會把字符串當作一個模版&#xff0c;通過傳入的參…

藍牙 sig base uuid_藍牙模塊采用陶瓷天線和PCB天線的區別

一、陶瓷天線陶瓷天線是一種適合于藍牙設備使用的小型化天線,又分為塊狀陶瓷天線和多層陶瓷天線。陶瓷天線占用空間很小、性能比較好&#xff1b; 帶寬窄&#xff0c;比較難做到多頻段&#xff1b;有效提高主板的整合度&#xff0c;并可降低天線對ID的限制&#xff1b;需要在主…

kubernetes系列12—二個特色的存儲卷configmap和secret

本文收錄在容器技術學習系列文章總目錄 1、configmap 1.1 認識configmap ConfigMap用于保存配置數據的鍵值對&#xff0c;可以用來保存單個屬性&#xff0c;也可以用來保存配置文件。ConfigMap跟secret很類似&#xff0c;但它可以更方便地處理不包含敏感信息的字符串。 1.2 創建…

華為完成拉美銅網寬帶G.fast技術部署測試

1/11/2016,英國大東通信巴拿馬分公司日前與華為公司發布消息稱&#xff0c;覆蓋拉丁美洲地區的最快銅纜寬帶服務系統成功完成初次測試。 作為巴拿馬地區領先的移動寬帶服務提供商&#xff0c;大東通信巴拿馬分公司也是當地最大的電信服務提供商&#xff0c;此次與華為合作在現有…

kotlin調用類中的方法_一種輕松的方法來測試Kotlin中令人沮喪的靜態方法調用

kotlin調用類中的方法by Oleksii Fedorov通過Oleksii Fedorov 一種輕松的方法來測試Kotlin中令人沮喪的靜態方法調用 (A stress-free way to test frustrating static method calls in Kotlin) Let me make a wild guess… You have encountered some code in Kotlin that is …

python圖像加密模塊_使用Pycryp的圖像加密和解密

這和加密或解密文本是一樣的。示例首先導入一些模塊&#xff1a;from Crypto.Cipher import AESfrom Crypto import Random然后&#xff0c;讓我們生成一個鍵和一個初始化向量。key Random.new().read(AES.block_size)iv Random.new().read(AES.block_size)加密下面的代碼加載…