1
0
Fork 0
docsearch/docs
Sylvain Pace a732a30470
Doc/update content (#443)
* # This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

chore(deps): update dependency onchange to v4.1.0

integrate previous work

enhance tyle/content

reformat part 1

wait for review

adance start_urls

enhance attributes description

fix typo

proofread documentation/docsearch

add apiKey mention

intefrate review and small fixes

finished proofreading

update sclient-rendering

use unseen review

# This is the commit message #2:

update README #269

# This is the commit message #3:

fix json

# This is the commit message #2:

enhance  as algolia/docsearch-configs#387

# This is the commit message #3:

updating flavicon

# This is the commit message #2:

Update 1-customize-configuration-file.html.md.erb

* # This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

chore(deps): update dependency onchange to v4.1.0

integrate previous work

enhance tyle/content

reformat part 1

wait for review

adance start_urls

enhance attributes description

fix typo

proofread documentation/docsearch

add apiKey mention

intefrate review and small fixes

finished proofreading

update sclient-rendering

use unseen review

# This is the commit message #2:

update README #269

# This is the commit message #3:

fix json

# This is the commit message #2:

enhance  as algolia/docsearch-configs#387

# This is the commit message #3:

updating flavicon

# This is the commit message #2:

Update 1-customize-configuration-file.html.md.erb

* documenting algolia/docsearch-scraper#387

* documenting algolia/docsearch-scraper#387

* fixing changelog

* fixing typo

* # This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

chore(deps): update dependency onchange to v4.1.0

integrate previous work

enhance tyle/content

reformat part 1

wait for review

adance start_urls

enhance attributes description

fix typo

proofread documentation/docsearch

add apiKey mention

intefrate review and small fixes

finished proofreading

update sclient-rendering

use unseen review

# This is the commit message #2:

update README #269

# This is the commit message #3:

fix json

# This is the commit message #2:

enhance  as algolia/docsearch-configs#387

# This is the commit message #3:

updating flavicon

# This is the commit message #2:

Update 1-customize-configuration-file.html.md.erb

* # This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

# This is a combination of 3 commits.
# This is the 1st commit message:

chore(deps): update dependency onchange to v4.1.0

integrate previous work

enhance tyle/content

reformat part 1

wait for review

adance start_urls

enhance attributes description

fix typo

proofread documentation/docsearch

add apiKey mention

intefrate review and small fixes

finished proofreading

update sclient-rendering

use unseen review

# This is the commit message #2:

update README #269

# This is the commit message #3:

fix json

# This is the commit message #2:

enhance  as algolia/docsearch-configs#387

# This is the commit message #3:

updating flavicon

# This is the commit message #2:

Update 1-customize-configuration-file.html.md.erb

* documenting algolia/docsearch-scraper#387

* documenting algolia/docsearch-scraper#387

* fixing typo

* fixing style issue

* fixing recurrnet issue

* general github handle

* fixing missed conflict

* fix and closes algolia/docsearch-configs-private#82

* remove builded content

* adding hitsperpage

* fix

* enhance

* doc proof reading part 1

* adding how to build an index and updating content

* reformat

* textlint

* typos

* Update behavior.md

* Update config-file.md

* Update crawler-overview.md

* Update dropdown.md

* Update faq.md

* Update how-do-we-build-an-index.md

* Update how-does-it-work.md

* Update inside-the-engine.md

* Update integrations.md

* Update styling.md

* Update tips.md

* Update who-can-apply.md

* Update integrations.md

* Usefull but sometime we do want to ignore it on purpose

* 4fca279b9a

* auto fix & formating

* adding pictures
2018-09-04 09:05:49 +02:00
..
scripts Deploy documentation website on push to master 2018-08-27 20:11:56 +02:00
src Doc/update content (#443) 2018-09-04 09:05:49 +02:00
.babelrc Move all new docs to docs/ subfolder 2018-08-20 13:23:35 +02:00
.eslintignore Add Markdown linting 2018-08-22 20:08:49 +02:00
.prettierrc.js Prettify the markdown 2018-08-24 15:59:55 +02:00
.remarkrc.js Make prettier format everything 2018-08-24 15:51:55 +02:00
.stylelintrc.js Fix z-Index of poppin and add linting of CSS 2018-08-20 13:24:55 +02:00
.textlint.terms.json Lint for misspelling 2018-08-24 12:36:11 +02:00
.textlintrc.js Doc/update content (#434) 2018-09-04 08:47:38 +02:00
config.json Doc/update content (#443) 2018-09-04 09:05:49 +02:00
package.json chore(deps): update dependency glob to v7.1.3 2018-09-02 03:39:06 +00:00
README.md Deploy documentation website on push to master 2018-08-27 20:11:56 +02:00
tailwind.config.js docs(styling): Fix positioning on Safari 2018-08-23 12:51:50 +02:00
yarn.lock chore(deps): update dependency glob to v7.1.3 2018-09-02 03:39:06 +00:00

Documentation website

This subdirectory holds the documentation website content as well as scripts to generate it.

Main commands

Building the website

You can build a new version of the website by running yarn run build in this directory or yarn run docs:build at the repository root.

It will read all source files in ./src and build the final static website in ./dist.

Local development

You can run a local copy of the documentation website by running yarn run serve. This is an alias for running yarn run docs:serve at the repository root.

This will build the website in ./dist and expose it on localhost, along with live-reload.

Deploying the website

You can deploy the website manually by running yarn run deploy in this directory or yarn run docs:deploy at the repository root.

This will build the website and then commit the content of the ./dist folder to the gh-pages branch and push it to GitHub.

Netlify is configured to listen to all commits on master and run netlify-master (seenetlify.toml in the root). This script will check if any changes were made in the ./docs subfolder. If no changes were made, it will finish, otherwise it will build the website and push it to gh-pages.

Internals

The documentation generation is not using any existing static websites generators, but custom JavaScript scripts.

The main two entry points are ./scripts/build.js and ./scripts/serve.js. The second one adds a webserver with live-reload on top of the first one.

HTML

All Markdown files situated in ./src will be transformed into .html files in ./dist. They will be wrapped into the layout defined in their front-matter.

All the headers will be converted to their respective <hX> tag, along with a unique #id to allow for easy anchoring.

You can also use plain HTML inside those Markdown files if you need more advanced styling.

Layouts

All layouts are saved in the ./src/_layouts folder.

All config options defined into config.json are passed to the layouts and can be used there.

You can also use mixins or include other files from the layouts.

Note that the current layout logic is simple and might not handle complex recursive cases, but should be enough for simple cases.

CSS

CSS is processed through PostCSS. It expects an entry file in ./src/style.css.

We are using postcss-import, allowing you to @import files from the ./src/_styles/ directory to better split your CSS code in logical chunks.

Most of the styling based on tailwind.css, with the config file behing tailwind.config.js. It contains default sizing and coloring to follow the Algolia brand guidelines.

The final CSS files is then compressed through PurgeCSS (to keep CSS classes that are actually used) and CleanCSS (to minify it).

JavaScript

JavaScript code is processed through Babel. It will compile all files situated in ./src/js.

Note that it compiles JS, and does not bundle it. We might add Webpack/Parcel support later.

Assets

Any file with the following extensions found in the ./src folder will be automatically copied to the ./dist folder with the same folder structure: gif, jpg, png, ico, html, svg and woff.

Placeholders

Values defined in the placeholders key of the config.json file can be used in JavaScript and Markdown files by using the {{key}} syntax.

For example if you have:

// config.json
{
  "placeholders": {
    "projectVersion": "1.4.2"
  }
}

Every occurrence of {{projectVersion}} in any .md or .js file will be replaced with 1.4.2.

Sidebar

The left sidebar of the documentation is generated based on the sidebar key of the config.json. The key should contain an array where each key is a part of the sidebar, with a title and a list of pages. Each of those pages in turn is an object with a title and url value.

The layout will then automatically create all the links and color the active page. Subsections inside the current page will also be added for every h2 element extracted from the markup of the current page.

Redirects

The config.json file can hold a redirects array, with object containing both a from and a to key. For each from, it will create a plain HTML page at this location, that will redirect anyone visiting it to the page defined in to.

Note that both those links must be defined as relative to the site.url value.