Skip to content

Commit

Permalink
Added DocSearch for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed Feb 1, 2022
1 parent 193e753 commit 1fbb9cf
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_ALGOLIA_APP_ID=
VITE_APP_ALGOLIA_API_KEY=
VITE_APP_ALGOLIA_INDEX_NAME=
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ docs/ export-ignore
excludes/ export-ignore

.editorconfig export-ignore
.env.example export-ignore
.gitattributes export-ignore
.gitignore export-ignore

Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: docs
on:
workflow_dispatch:
repository_dispatch:
types:
- generate-docs
types:
- generate-docs
release:
types:
- created
types:
- created

jobs:
handle-dispatch:
Expand Down Expand Up @@ -35,11 +35,14 @@ jobs:
${{ runner.os }}-npm-
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm i

- name: Build VuePress site
run: npm run build
env:
VITE_APP_ALGOLIA_APP_ID: ${{ secrets.VITE_APP_ALGOLIA_APP_ID }}
VITE_APP_ALGOLIA_API_KEY: ${{ secrets.VITE_APP_ALGOLIA_API_KEY }}
VITE_APP_ALGOLIA_INDEX_NAME: ${{ secrets.VITE_APP_ALGOLIA_INDEX_NAME }}

- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vendor/

.cache
.DS_Store
.env
.php_cs.cache
.phpintel
.temp
Expand Down
4 changes: 4 additions & 0 deletions docs/.vuepress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache/
.temp/

dist/
19 changes: 16 additions & 3 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
const fs = require('fs');
const path = require('path');

require('dotenv').config();

const hostname = 'laravel-lang.com';

module.exports = {
lang: 'en-US',
title: 'Laravel Lang',
description: 'List of 78 languages for Laravel Framework 4-9, Jetstream, Fortify, Breeze, Cashier, Nova, Spark and UI.',

head: [
['link', { rel: 'icon', href: '/images/logo.svg' }],
['meta', { name: 'twitter:image', content: 'https://laravel-lang.com/images/social-logo.png' }]
['meta', { name: 'twitter:image', content: `https://${ hostname }/images/social-logo.png` }]
],

theme: '@vuepress/theme-default',
themeConfig: {
hostname,
base: '/',

logo: '/images/logo.svg',
Expand Down Expand Up @@ -88,7 +93,15 @@ module.exports = {
description: $page => $page.frontmatter.description,
type: _ => 'website',
image: (_, $site) => $site.domain + '/images/social-logo.png'
}
},
[
'@vuepress/docsearch',
{
appId: process.env.VITE_APP_ALGOLIA_APP_ID,
apiKey: process.env.VITE_APP_ALGOLIA_API_KEY,
indexName: process.env.VITE_APP_ALGOLIA_INDEX_NAME
}
]
]
]
};
Expand Down Expand Up @@ -118,7 +131,7 @@ function getChildren(folder, sort = 'asc') {
}

function resolveNumeric(value) {
const sub = value.substr(0, value.indexOf('.'));
const sub = value.substring(0, value.indexOf('.'));

const num = Number(sub);

Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/Laravel-Lang/lang/issues"
},
"scripts": {
"dev": "vuepress dev docs",
"dev": "vuepress dev docs --debug",
"build": "vuepress build docs"
},
"repository": {
Expand All @@ -20,8 +20,11 @@
"docs"
],
"devDependencies": {
"@vuepress/plugin-theme-data": "^2.0.0-beta.33",
"vuepress": "^2.0.0-beta.33",
"@vuepress/plugin-docsearch": "^2.0.0-beta.35",
"@vuepress/plugin-theme-data": "^2.0.0-beta.35",
"@vueuse/core": "^7.5.5",
"dotenv": "^15.0.0",
"vuepress": "^2.0.0-beta.35",
"vuepress-plugin-seo": "^0.2.0"
}
}

0 comments on commit 1fbb9cf

Please sign in to comment.