Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Translating page-creation #127

Merged
merged 2 commits into from
Jan 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/docs/page-creation.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
title: Page Creation
title: Criação de Página
---

A page is created by calling the [createPage](/docs/actions/#createPage) action. There are three main side effects that occur when a page is created.
Uma página é criada chamando a função [createPage](/docs/actions/#createPage). Existem três principais consequências que ocorrem quando uma página é criada.

1. The `pages` redux namespace is updated
1. The `components` redux namespace is updated
1. `onCreatePage` API is executed
1. O namespace redux das `páginas` é atualizado
2. O namespace redux dos `componentes` é atualizado
3. A API `onCreatePage` é executada

## Update Pages redux namespace
## Atualizar redux namespace das páginas

The `pages` redux namespace is a map of page `path` to page object. The [pages reducer](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/reducers/pages.js) takes care of updating this on a `CREATE_PAGE` action. It also creates a [Foreign Key Reference](/docs/schema-gql-type/#foreign-key-reference-___node) to the plugin that created the page by adding a `pluginCreator___NODE` field.
O namespace redux das `páginas` é um mapa do `caminho` da página para o objeto da página. O [pages reducer](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/reducers/pages.js) é responsável por atualizar a página utilizando a ação `CREATE_PAGE`. Ele também cria uma [Referência de Chave Estrangeira](/docs/schema-gql-type/#foreign-key-reference-___node) no plugin que criou a página, adicionando um campo `pluginCreator___NODE`.

## Update Components redux namespace
## Atualizar redux namespace dos componentes

The `components` redux namespace is a map of [componentPath](/docs/behind-the-scenes-terminology/#component) (file with React component) to the Component object. A Component object is simply the Page object but with an empty query string (that will be set during [Query Extraction](/docs/query-extraction/#store-queries-in-redux)).
O namespace redux dos `components` é um mapa do [componentPath](/docs/behind-the-scenes-terminology/#component) (arquivo com o componente React) para o objeto de um componente. Um objeto de um componente é simplesmente o objeto da página, mas com uma string de consulta vazia (que será definida durante [Extração de Consulta](/docs/query-extraction/#store-queries-in-redux)).

## onCreatePage API
## API onCreatePage

Every time a page is created, plugins have the opportunity to handle its [onCreatePage](/docs/node-apis/#onCreatePage) event. This is used for things like creating `SitePage` nodes in [Internal Data Bridge](/docs/internal-data-bridge/), and for "path" related plugins such as [gatsby-plugin-create-client-paths](/packages/gatsby-plugin-create-client-paths/) and [gatsby-plugin-remove-trailing-slashes](/packages/gatsby-plugin-remove-trailing-slashes/).
Sempre que uma página é criada, os plugins têm a oportunidade de manipular seu evento [onCreatePage](/docs/node-apis/#onCreatePage). Isso é usado para coisas como a criação de nós `SitePage` no [Internal Data Bridge](/docs/internal-data-bridge/), e para plugins relacionados ao "caminho", como [gatsby-plugin-create-client-paths](/packages/gatsby-plugin-create-client-paths/) e [gatsby-plugin-remove-trailing-slashes](/packages/gatsby-plugin-remove-trailing-slashes/).