Skip to content

Commit 25eaa4c

Browse files
committed
Fix GitHub Pages deployment to root URL
1 parent a4c87fb commit 25eaa4c

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

.github/workflows/jekyll-gh-pages.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ jobs:
3939
gem install bundler
4040
bundle update --bundler
4141
bundle install
42-
bundle exec jekyll build
42+
# Build Jekyll site with baseurl set to empty string
43+
JEKYLL_ENV=production bundle exec jekyll build --baseurl=""
4344
env:
4445
JEKYLL_ENV: production
4546

4647
- name: Upload artifact
4748
uses: actions/upload-pages-artifact@v3
4849
with:
50+
# Deploy the _site directory to the root of the GitHub Pages site
4951
path: www/_site
5052

5153
# Deployment job

configure-gh-pages.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Script to help configure GitHub Pages settings
4+
5+
# Colors for output
6+
GREEN='\033[0;32m'
7+
YELLOW='\033[1;33m'
8+
RED='\033[0;31m'
9+
NC='\033[0m' # No Color
10+
11+
echo -e "${YELLOW}GitHub Pages Configuration Helper${NC}"
12+
echo -e "${YELLOW}=================================${NC}\n"
13+
14+
echo -e "${YELLOW}This script will help you configure GitHub Pages to deploy your site to the root URL.${NC}"
15+
echo -e "${YELLOW}Please follow these steps:${NC}\n"
16+
17+
echo -e "1. ${GREEN}Go to your GitHub repository:${NC}"
18+
echo -e " https://github.com/ipcrypt-std/www/settings/pages\n"
19+
20+
echo -e "2. ${GREEN}Under 'Build and deployment' section:${NC}"
21+
echo -e " - Source: ${YELLOW}GitHub Actions${NC}"
22+
echo -e " (This should already be selected)\n"
23+
24+
echo -e "3. ${GREEN}Under 'Custom domain' section:${NC}"
25+
echo -e " - Make sure this is empty (unless you want to use a custom domain)\n"
26+
27+
echo -e "4. ${GREEN}Check your repository name:${NC}"
28+
echo -e " - If your repository is named 'ipcrypt-std.github.io', your site will be published at:"
29+
echo -e " ${YELLOW}https://ipcrypt-std.github.io/${NC}"
30+
echo -e " - If your repository is named 'www', your site will be published at:"
31+
echo -e " ${YELLOW}https://ipcrypt-std.github.io/www/${NC}"
32+
echo -e " - To publish at the root URL with a repository named 'www', you need to:"
33+
echo -e " a. Create a new repository named 'ipcrypt-std.github.io'"
34+
echo -e " b. Push your code to that repository"
35+
echo -e " c. Configure GitHub Pages as described above\n"
36+
37+
echo -e "5. ${GREEN}Alternative approach - Create a gh-pages branch:${NC}"
38+
echo -e " If you want to keep your repository name as 'www' but deploy to the root URL,"
39+
echo -e " you can create a gh-pages branch with a special structure:"
40+
echo -e " $()$(bash"
41+
echo -e " git checkout --orphan gh-pages"
42+
echo -e " git rm -rf ."
43+
echo -e " echo '<meta http-equiv=\"refresh\" content=\"0;url=https://ipcrypt-std.github.io/www/\">' \
44+
git add index.html"
45+
echo -e " git commit -m \"Add redirect to www subdirectory\""
46+
echo -e " git push origin gh-pages"
47+
echo -e " >index.html"
48+
echo -e ")$()"
49+
echo -e " Then in GitHub repository settings, set the source to 'Deploy from a branch'"
50+
echo -e " and select the 'gh-pages' branch.\n"
51+
52+
echo -e "${YELLOW}After making these changes, your site should be deployed to the root URL.${NC}"
53+
echo -e "${YELLOW}It may take a few minutes for the changes to take effect.${NC}\n"
54+
55+
echo -e "${GREEN}Done!${NC}"

0 commit comments

Comments
 (0)