Skip to content

Commit 595d9c5

Browse files
fixed search feature using jq in workflow (#466)
* fixed url * search workflow done
1 parent 4ef520d commit 595d9c5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: Render Quarto site
3737
run: quarto render
3838

39+
- name: Rename original search index
40+
run: mv _site/search.json _site/search_original.json
41+
3942
- name: Save _freeze folder
4043
id: cache-primes-save
4144
uses: actions/cache/save@v4
@@ -44,6 +47,22 @@ jobs:
4447
_freeze/
4548
key: ${{ runner.os }}-primes-${{ github.run_id }}
4649

50+
- name: Install jq
51+
run: sudo apt-get install jq
52+
53+
- name: Fetch search_original.json from main site
54+
run: curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/gh-pages/search_original.json
55+
56+
- name: Convert main site search index URLs to relative URLs
57+
run: |
58+
jq 'map(
59+
if .href then .href = "../" + .href else . end |
60+
if .objectID then .objectID = "../" + .objectID else . end)' search_original.json > fixed_main_search.json
61+
62+
- name: Merge both search index
63+
run: |
64+
jq -s '.[0] + .[1]' _site/search_original.json fixed_main_search.json > _site/search.json
65+
4766
- name: Deploy to GitHub Pages
4867
uses: JamesIves/github-pages-deploy-action@v4
4968
with:

0 commit comments

Comments
 (0)