Code Monkey home page Code Monkey logo

saleor-docs's Introduction

Saleor Documentation

What's In This Document

Get Started in 5 Minutes

  1. Make sure you are using Node in version 12+:
node --version
  1. Install project dependencies:
npm install
  1. Run your dev server:
npm start

Production Build

  1. Build project:
npm run build
  1. Testing build local:
npm run serve

Editing Content

Directory Structure

  • /docs Current Canary developer documentation.
  • /docs/api-reference Automatically generated API reference.
  • /docusaurus.config.js Docusaurus configuration file.
  • /docusaurus2-graphql-doc-generator GraphQL API Reference plugin code.
  • /sidebars.js Sidebar menu structure.
  • /static Styling and other static files.
  • /versioned_docs & /versioned_sidebars Tagged versions of documentation matching the latest Saleor release.

Formatting

Code formatting

Code and response examples should be inside code blocks with proper language:

```graphql
query {
  id
  name
}
```
```json
{
  "errorCode": 400
}
```

Lining pages

Use full path to the file to avoid linking to wrong page.

  • โœ… Example of good link: [Attributes](/docs/developer/attributes.mdx)
  • ๐Ÿ›‘ Avoid: [Attributes](/attributes)

Using custom React components

All documentation files use extension:

  • .mdx - Developer documentation
  • .md - Dashboard documentation

If your page uses custom react components, you are required to use .mdx file extension. Import statement is also required:

## <!-- /docs/developer/export/export-overview.mdx file -->

## title: Exporting Products

import Foo from "@site/components/Foo";

...

<Foo />

For charts we are using Mermaid package.

Editing an existing docs page

Edit docs by navigating to docs/ and editing the corresponding document:

docs/doc-to-be-edited.md

---
id: page-needs-edit
title: This Doc Needs To Be Edited
---

Edit me...

For more information about docs, click here

Adding Content

Adding a new docs page to an existing sidebar

  1. Create the doc as a new markdown file in /docs, example docs/newly-created-doc.md:
---
id: newly-created-doc
title: This Doc Needs To Be Edited
---

My new content here..
  1. Refer to that doc's ID in an existing sidebar in sidebar.js:
// Add newly-created-doc to the Getting Started category of docs
{
  "docs": {
    "Getting Started": [
      "quick-start",
      "newly-created-doc" // new doc here
    ],
    ...
  },
  ...
}

For more information about adding new docs, click here

Adding items to your site's top navigation bar

  1. Add links to docs, custom pages or external links by editing the headerLinks field of siteConfig.js:
{
  headerLinks: [
    ...
    /* you can add docs */
    {
      type: "doc",
      docId: "dashboard/before-you-start",
      label: "Dashboard Manual",
      position: "left",
    },
    /* you can add custom pages */
    { page: 'help', label: 'Help' },
    /* you can add external links */
    { href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' },
    ...
  ],
  ...
}

For more information about the navigation bar, click here

Adding custom pages

  1. Docusaurus uses React components to build pages. The components are saved as .js files in ./pages/en:
  2. If you want your page to show up in your navigation header, you will need to update siteConfig.js to add to the headerLinks element:
{
  headerLinks: [
    ...
    { page: 'my-new-custom-page', label: 'My New Custom Page' },
    ...
  ],
  ...
}

For more information about custom pages, click here.

Updating the API Reference & Storefront Reference

Files in /docs/api-reference are generated by @graphql-markdown/docusaurus package. Introduction pages are automatically copied from /template/api-reference.mdx and /template/storefromt/api-reference.mdx files.

Updating

To update the API reference:

  1. Put schema.graphql locally into the root of the saleor-docs repository
  2. Run npm run update-api-reference

The script behind the scenes does several steps:

  1. The api-reference is generated in .tmp folder.
  2. The highlighting script does additional improvements in the generated docs. It makes the Saleor version and required permissions more visible.
  3. The current references from docs folder are being removed and generated references in .tmp folder are moved to the docs.
  4. The code examples are being injected. The code examples from the examples folder are being put into corresponding files in the references folder.

Search

Saleor Docs are using Algolia DocSearch for the website search.

Crawl interval

DocSearch crawls the website once a week on Friday and aggregates all the content in an Algolia index. This content is then queried directly from the front-end using the Algolia API.

Ranking strategy

The website's search results are meticulously ranked to enhance user relevance and experience. A custom ranking function, known as pageRank, is employed for this purpose. The ranking strategy prioritizes various content categories as follows:

  1. metaPageRank: This takes precedence and is determined by a custom meta attribute, providing a top-tier ranking for specific content.

  2. Documentation Pages: General documentation pages are next in line for ranking, excluding those generated based on schema API reference and API storefront.

  3. API Reference Pages: These pages are ranked differently based on the type of operation they represent.

function pageRank(url) {
  if (metaPageRank) {
    return metaPageRank;
  }
  if (!/\/api-reference\/|\/api-storefront\//.test(url.pathname)) {
    // not part of API reference
    return "40";
  }
  if (/\/mutations\//.test(url.pathname)) {
    // mutation
    return "30";
  }
  if (/\/queries\//.test(url.pathname)) {
    // query
    return "20";
  }
  return "10";
}

Manual Ranking Control

For even finer control over search result rankings, you can manually influence the ranking of specified pages by adding a custom meta attribute - rank - to the page. The rank meta is configured to have the highest priority in Algolia.

To assign a custom rank to a particular page, use the following code snippet:

<head>
  <meta name="rank" content="50" />
</head>

Debugging

In dev mode, Docusaurus serves a debug page with a list of all available routes and config at http://localhost:3000/\_\_docusaurus/debug.

Full Docusaurus Documentation

Full documentation can be found on the website.

saleor-docs's People

Contributors

2can avatar aniav avatar benekex2 avatar cloud11pl avatar cossackdex avatar dependabot[bot] avatar github-actions[bot] avatar ikarbowiak avatar jakubkuc avatar kadewu avatar karolkielecki avatar korycins avatar krzysztofwolski avatar krzysztofzuraw avatar lkostrowski avatar maarcingebala avatar magul avatar monikamrozek avatar patrys avatar pawelpikus avatar peelar avatar przlada avatar rafalp avatar szdrasiak avatar timcla avatar timuric avatar tomaszszymanski129 avatar typeofweb avatar witoszekdev avatar zedzior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saleor-docs's Issues

Inconsistent columns

Screenshot 2019-08-14 at 13 25 52

Cards for subcategories are not keeping their columns (see Naming Conventions)

Document Saleor's core codebase structure and patterns

In the "Contributing Guide" we could document things like:

  • structure of a module in Saleor, what files it consists of and what is the purpose of each file (as they're mostly the same for all modules)
  • structure of Graphene/GraphQL modules

Some files are very specific (like utils.py / actions.py) and it would useful, even for us, to know what are the rules for organizing our functions in those files.

actions.py is a good example because it should contain business logic. In the docs, we should then tell what do we mean by that and what is business logic and what isn't.

Wrong routing

Some of the cards links in the docs returns a 404 but when I try to access via the sidebar it works.

I've noticed that the non working links on the cards e.g. points to docs/customization/intro/customization/docker.md while on the sidebar it points to docs/customization/docker/

Sidebar links don't work on mobile

  1. Open the sidebar
  2. Click a link, e.g. "Customizing Saleor"
  3. Close the sidebar
  4. The page is still the home page

Screenshot

Browser: Firefox Focus
OS: Android

Document metadata API

We have now a generic metadata API, we should provide a guide to describe:

  • all metadata operations - updating, deleting and clearing
  • difference between private / public metadata
  • list of types that support metadata

Update guide for creating checkout

paymentClientToken in now deprecated. We need to update the checkout guide to mention what's the preferred way of getting the gateway's config.

Better docs for Product Attributes

Product Attributes need their own documentation and best practices section.
What I would like to see there:

  • info that I can and it would be good idea do have same slug (ex. color) if I have few attributes with same purpose for different product types
  • it would be good to mention that Attribute Value slugs don't have to be unique system vide

Add documentation about reordering

Once saleor/saleor#4353 is closed, we will have a unified way of sorting nodes. We should document this.

But, there is one exception: product images. They don't apply to it as we are only doing operations a few images (3, 10, ..., 15). They take no given positions, but instead takes the list of images to perform an enumeration.

All the other mutations are taking relative sort orders.

Warning about saleor not storing the currencies is outdated

The documentation says the following:

The currency is not stored in the database. Changing the default currency in a production environment will not recalculate any existing orders. All numbers will remain the same and will be incorrectly displayed under the new currency.

Which is not true anymore. We should decide what to say instead. We don't support multiple currencies at the moment, but we do store them for future handling of multicurrency.

Document OpenTracing configuration

We've recently added OpenTracing support. We need to add documentation to describe:

  • what is OpenTracing and what it does (briefly)
  • how to configure it in Saleor
  • example of how to use it with Jaeger

Add the two possible ways to set an environment variable on the Windows installation guide

I noticed a few times users getting confused about $env:SECRET_KEY = "<mysecretkey>" not working because they were using cmd.exe instead of powershell.

We could add a note that they need to use powershell but as it's the only part of the installation process that actually requires setting an environment variable, it would probably be best to simply include both ways:

$env:SECRET_KEY = "<mysecretkey>"

SET "SECRET_KEY=something"

The second is also useful for users wanting to create batch scripts (instead of powershell scripts) to run saleor or to run some saleor task/commands.

Automatically detect invalid relative links before merging

Docusaurus displays warnings if there are dead links found by build. We should check it out, and see if it handles all kind of relative links.

It would be very easy to generate dead links over the time as we are doing implicit references unlike reST that would raise an error. And we might miss an invalid link in PR review, e.g. .md, docs/blah, ...

It could be really good to have a travis check for that or any other CI.

Installation steps Prepare front-end assets command doesn't exist

Hello everyone,
I was following the steps on the installation guide and when I try to run the command npm run build-assets it seems this command doesn't exist anymore. This is what npm throws back at me:

npm ERR! missing script: build-assets
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     build-schema
npm ERR!     build-emails

I think the build-assets was renamed to build-schema? I'm happy to raise a PR that fixes the docs if this is the case.

Thank you for reading ๐Ÿ‘

Update payments documentation

In the docs there are still references to CHECKOUT_PAYMENT_GATEWAYS setting which is no longer supported. We need to document how to configure payment gateways.

Undocumented setting "ALLOWED_CLIENT_HOSTS"

What I'm trying to achieve

While I was trying to create new staff members via the Dashboard 2.0 I came across a new setting "ALLOWED_CLIENT_HOSTS" in the saleor core. Unfortunately I don't know, what this setting is doing, what is affected when I change it and I can't find any documentation on that issue anywhere

What I expected to happen

I'm expecting to understand all settings before I'm using it.

Document Celery tasks

It would be useful to document all the Celery tasks that we have in Saleor. A section about this would fit in the "Running your own Saleor server" part.

Write documentation on exposing the locally running instance

For certain tasks the developer may need to expose a locally running instance of Saleor to the outside world. One such case is payments integration where callbacks happen over web hooks. We should document working with tools such as ngrok to make this easier.

Document account registration settings

Add documentation for ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL setting. It's used to enable account confirmation by email. It needs to be used with ALLOWED_CLIENT_HOSTS (we need a storefront address to build a URL included in the confirmation email) and we need to document that as well.

S3 ACL description in deployment guide

Settings.py: AWS_DEFAULT_ACL = os.environ.get("AWS_DEFAULT_ACL", None)

By default uploaded files will have permissions inherited from s3 bucket settings. It may be a good idea to write about this in docs.
In our case it was confusing because images uploaded from dashboard were not accessible by the users. In our case we decided to use policy public-read)

npm run build-assets

What I'm trying to achieve

Following the standard documentation to install saleor on windows (https://docs.saleor.io/docs/getting-started/installation-windows/). On reaching step 9, I ran into the problem of

npm ERR! missing script: build-assets
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     build-schema
npm ERR!     build-emails

npm ERR! A complete log of this run can be found in:

Please how can I fix this error?

System information
Operating system: Windows 10

Have a way of generating permalinks to a page

When replying to a question of an user, I would like to be able to link the users to a given version of the docs to avoid a reply being totally useless for the next users coming through the ticket reply.

What I would think would be enough, is having a "Permalink" button to copy/paste whether at the top of the pages or at the titles levels.

Issue is that every latest versions are not "archived" by default. We could always move them the "archived" link (docs/x.x.x/blah/) but it could be bad for SEO. Maybe we could have a way of redirecting users? e.g. redirect.html?version=2.8.0&page=blah#we-should-redirect-users-to-the-correct-ID-as-well โ€“ it would check whether the given version is latest or archived, and then will whether redirect to the latest version or the archived page.

Maybe we should open a modal that shows the perma link with a disabled text input + copy button?

Broken links in Docs

There are some broken links in docs in intro.md file.
I want to correct them and work on this issue as of Hackoberfest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.