Create 404.html error file with Jekyll #45586
-
Select Topic AreaQuestion BodyHello, in Jekyll and with Github Pages, how it is possible to create custom 404 error file called 404.html in order to add HTML code instead of Markdown. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @salimbenfarhat Here are some steps you can take to create the 404 error file. a. create a new file in your Jekyll project called 404.html. This file should be located in the root directory of your project. b. in this file, you can add your custom HTML code. You can also include Jekyll liquid tags to include dynamic content. c. in your _config.yml file, add the following line: permalink: /404.html d. this will ensure that Jekyll generates a 404.html file in your site's root directory. e. commit the changes and push the code to your GitHub repository. f. go to your GitHub Pages repository settings, and set the custom 404 page to your 404.html file. then go ahead and load website to see. |
Beta Was this translation helpful? Give feedback.
Hello @salimbenfarhat Here are some steps you can take to create the 404 error file.
a. create a new file in your Jekyll project called 404.html. This file should be located in the root directory of your project.
b. in this file, you can add your custom HTML code. You can also include Jekyll liquid tags to include dynamic content.
c. in your _config.yml file, add the following line: permalink: /404.html
d. this will ensure that Jekyll generates a 404.html file in your site's root directory.
e. commit the changes and push the code to your GitHub repository.
f. go to your GitHub Pages repository settings, and set the custom 404 page to your 404.html file.
then go ahead and load website to see.