Skip to content

Commit 3ddd373

Browse files
committed
misc tweaks
- add google analytics - auto build algolia index - update edit URL - etc.
1 parent a2b75e7 commit 3ddd373

3 files changed

Lines changed: 41 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- source
7+
# Lets you re-index on demand from the Actions tab without pushing.
8+
workflow_dispatch:
79

810
permissions:
911
contents: read
@@ -43,4 +45,27 @@ jobs:
4345

4446
- name: Deploy to GitHub Pages
4547
id: deployment
46-
uses: actions/deploy-pages@v4
48+
uses: actions/deploy-pages@v4
49+
50+
index-search:
51+
needs: build-and-deploy
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
57+
# deploy-pages returns as soon as the deployment is created; the CDN
58+
# needs a moment before the crawler sees the new pages.
59+
- name: Let the deployment propagate
60+
run: sleep 60
61+
62+
- name: Run DocSearch scraper
63+
env:
64+
APPLICATION_ID: 9JAHOV00P8
65+
API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
66+
run: |
67+
docker run \
68+
-e APPLICATION_ID \
69+
-e API_KEY \
70+
-e "CONFIG=$(jq -r tostring < docsearch-config.json)" \
71+
algolia/docsearch-scraper

‎docusaurus.config.js‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const config = {
6464
// Please change this to your repo.
6565
// Remove this to remove the "edit this page" links.
6666
editUrl:
67-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
67+
'https://github.com/phpseclib/phpseclib.github.io/tree/source/',
6868
},
6969
blog: {
7070
showReadingTime: true,
@@ -75,7 +75,7 @@ const config = {
7575
// Please change this to your repo.
7676
// Remove this to remove the "edit this page" links.
7777
editUrl:
78-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
78+
'https://github.com/phpseclib/phpseclib.github.io/tree/source/',
7979
// Useful options to enforce blogging best practices
8080
onInlineTags: 'warn',
8181
onInlineAuthors: 'warn',
@@ -84,6 +84,10 @@ const config = {
8484
theme: {
8585
customCss: './src/css/custom.css',
8686
},
87+
gtag: {
88+
trackingID: 'G-7M7XG2FC7M',
89+
anonymizeIP: true,
90+
},
8791
}),
8892
],
8993
],
@@ -106,9 +110,9 @@ const config = {
106110

107111
algolia: {
108112
appId: '9JAHOV00P8',
109-
apiKey: 'fc750310b29e51d39b7b66d0eca261b7',
113+
apiKey: 'd88000c9cf09fd7067f2db65c22d7c87',
110114
indexName: 'phpseclib',
111-
contextualSearch: false,
115+
contextualSearch: true,
112116
searchParameters: {},
113117
},
114118

‎temp.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
for d in docs versioned_docs/version-4.0 versioned_docs/version-3.0; do
2+
for s in cms file; do
3+
[ -d "$d/$s/inc" ] && git mv "$d/$s/inc" "$d/$s/_inc"
4+
done
5+
done
6+
7+
grep -rl "from './inc/" docs versioned_docs | xargs sed -i "s|from '\./inc/|from './_inc/|g"

0 commit comments

Comments
 (0)