Article directory
🌈【Ultimate Tutorial】JekyllCheats for multi-website configuration, enjoy accessing different web addresses and enjoyunlimitedpleasure! ✨🎈
🌈 Want to easily master Jekyll multi-site configuration skills? here hasBuild a static blog website from scratch on your local computerThe ultimate tutorial! From setting up different website access to enjoying unlimited fun, this guide will do it all! Let you become a website master! 💥🚀
Jekyll multiple static website configuration methods
edit _config.yml
file to configure Jekyll.
Configuration items include site title, description, theme, URL, etc...
When using Jekyll to build multiple websites locally, you can access different websites in the following ways:
Use a different port number:
- Each website can run on a different port number.
- For example, you can run your personal blog on the port
4001
on, run the project display website on the port4002
on. - In a browser, you can access different websites by specifying the port number in the URL.
- For example, to access the port running
4001
On your personal blog, you can enterhttp://localhost:4001
.
Here are some specific configuration examples:
Use a different port number:
# _config.yml 文件
port: 4001
Use a different domain name:
# _config.yml 文件
url: "http://blog.example. com"
Manage multiple Jekyll static websites
You can create a separate folder for each website, customizing each website with different profiles and content.
Example: Let's say you want to create a personal blog and a project showcase website.
personal blog:
- Create a file called
blog
folder. - On
blog
folder, create_config.yml
和index.md
file. - On
_config.yml
In the file, configure the site title, description, etc... - On
_posts
folder, add your blog post.
Project display website:
- Create a file called
portfolio
folder. - On
portfolio
folder, create_config.yml
和index.md
file. - On
_config.yml
In the file, configure the site title, description, etc... - On
_posts
folder, add your project information.
Publishing website:
- On
blog
folder, runjekyll serve
Order to publish a personal blog. - On
portfolio
folder, runjekyll serve
Command release project display website. - Using Jekyll to build multiple websites is a simple and effective way.
How to start a locally installed Jekyll website through a command?
To be launched via command line installed locally d:\Jekyll\site1\
For the Jekyll website, you can follow these steps:
1. Navigate to the Jekyll website folder:
- Open a command line or terminal.
- Navigate to the website folder using the command
d:
cd d:\Jekyll\site1\
2. Run the jekyll serve command:
jekyll serve
- This command will start the Jekyll server and start hosting your website locally.
3. You can view your website by accessing the following URL in your browser:
http://localhost:4001
Here are some additional tips:
- you can use
--port
option specifies the port number. For example, to host your website on port8080
, please run the following command:
jekyll serve --port 8080
- you can use
--config
Options specify the configuration file. For example, to use a file namedmyconfig.yml
configuration file, run the following command:
jekyll serve --config myconfig.yml
- you can use
--watch
Option to automatically restart the server when you make changes. For example, to enable monitor mode, run the following command:
jekyll serve --watch
- Deploy your website using the following command:
jekyll build
How to add article content in Jekyll?
Create a .md file to add content.
Jekyll support Markdown Grammar, which can be used to format text, insert images, create links, etc...
By following the tutorial below, you should be able to quickly create a website that suits your needs▼
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "Jekyll builds multiple static websites locally. How to configure the URLs for accessing different local websites?" 》, helpful to you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-31561.html
Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!