Skip to content

Commit

Permalink
chore: merge branch 'main' of github.com:deco-sites/starting into upd…
Browse files Browse the repository at this point in the history
…ate/to-app
  • Loading branch information
devartes committed Oct 30, 2023
2 parents 78aa09c + 0438afc commit 8961a9b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 36 deletions.
7 changes: 3 additions & 4 deletions docs/getting-started/creating-a-new-page/en.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
description: Create pages on deco.cx with no need to code
since: 1.0.0
---

You should be familiar with the core concepts of [Blocks](/docs/en/concepts/blocks) and [Section](/docs/en/concepts/sections), and now let's understand how to tie those together and create pages in a deco.cx site.

**Pages** have a dedicated section in deco.cx's Admin and you can access it via the top menu.

<img width="1001" alt="image" src="https://github.com/deco-cx/deco/assets/18706156/e93a3277-c9a4-4abf-b9d7-dd2c716d3d54">
![Creating pages](/docs/creating-new-page/pages-menu.png)

In this page, you see all the pages published on the site, alongside the path which they're accessible to your users.

Expand All @@ -21,9 +20,9 @@ To create a new page on your site, **click on the Create button in the top right

You'll be redirected to the page editor after the page is created. Now it's possible to edit and add new Sections available in your site and setup the page just as you want it.

To add a new Section to the page, click on **Add Page Section** button in the editor and check all the available options.
To add a new Section to the page, click on **Add Sections** button in the editor and check all the available options.

<img width="1512" alt="image" src="https://github.com/deco-cx/deco/assets/18706156/5699f4ea-29cf-41cd-933e-0dda8bc0b0df">
![Creating pages](/docs/creating-new-page/add-section.png)

> If you want to develop/code a new Section, check our [Developing Guide](/docs/en/developing/setup).
Expand Down
10 changes: 4 additions & 6 deletions docs/getting-started/creating-a-new-page/pt.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
description: Aprenda como criar páginas na deco.cx sem precisar de código
since: 1.0.0
---

Você deve estar familiarizado com os conceitos básicos de [Blocks](/docs/pt/concepts/blocks) e [Section](/docs/pt/concepts/sections) e agora vamos entender como usá-los para criar páginas em um site deco.cx.

<img width="1001" alt="image" src="https://github.com/deco-cx/deco/assets/18706156/e93a3277-c9a4-4abf-b9d7-dd2c716d3d54">
![Criando páginas](/docs/creating-new-page/pages-menu-pt.png)

Clique em **Pages** no menu superior e você poderá ver todas as páginas publicadas no site, juntamente com o _path_ que elas são acessíveis aos seus usuários.
Clique em **Páginas** no menu superior e você poderá ver todas as páginas publicadas no site, juntamente com o _path_ que elas são acessíveis aos seus usuários.

## Crie uma nova página

Expand All @@ -20,10 +19,9 @@ Para criar uma nova página em seu site, **clique no botão Criar no canto super

Após criada, você será redirecionado para o editor de página. Agora é possível editar e adicionar novas Sections disponíveis em seu site e configurar a página do jeito que você quiser.

Para adicionar uma nova Section à página, clique no botão **Add Page Section** no editor e verifique todas as opções disponíveis.

<img width="1512" alt="image" src="https://github.com/deco-cx/deco/assets/18706156/5699f4ea-29cf-41cd-933e-0dda8bc0b0df">
Para adicionar uma nova Section à página, clique no botão **Add Sections** no editor e verifique todas as opções disponíveis.

![Criando páginas](/docs/creating-new-page/add-section.png)

> Se você deseja desenvolver/codar uma nova seção, consulte nosso [Guia de desenvolvimento](/docs/en/developing/setup).
Expand Down
48 changes: 22 additions & 26 deletions docs/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const tableOfContents: TableOfContents = [
slug: "getting-started/updating-seo",
},
{
title: { pt: "Criando nova uma Página", en: "Creating a new Page" },
title: { pt: "Criando uma nova Página", en: "Creating a new Page" },
slug: "getting-started/creating-a-new-page",
}, // TODO
// {
Expand Down Expand Up @@ -472,7 +472,7 @@ if (import.meta.main) {
if (content.slug) {
const path = `./${content.slug}`;
const stat: { isDirectory: boolean } = await Deno.stat(path).catch(
(_) => ({ isDirectory: false })
(_) => ({ isDirectory: false }),
);
let isCreated = false;
if (!stat.isDirectory) {
Expand All @@ -490,22 +490,22 @@ if (import.meta.main) {
`---
description: TODO
since: 1.0.0
---`
---`,
);
await Deno.writeTextFile(
join(path, "pt.md"),
`---
description: TODO
since: 1.0.0
---`
---`,
);
continue;
}
} else if (content.children) {
for (const children of content.children) {
const path = `./${children.slug}`;
const stat: { isDirectory: boolean } = await Deno.stat(path).catch(
(_) => ({ isDirectory: false })
(_) => ({ isDirectory: false }),
);
if (!stat.isDirectory) {
if (
Expand All @@ -523,14 +523,14 @@ since: 1.0.0
`---
description: TODO
since: 1.0.0
---`
---`,
);
await Deno.writeTextFile(
join(path, "pt.md"),
`---
description: TODO
since: 1.0.0
---`
---`,
);
}
}
Expand All @@ -547,7 +547,7 @@ const tableOfContentsBySlug = tableOfContents.reduce((acc, cur) => {
if (!cur.slug) return acc;
acc[cur.slug] = cur;
return acc;
}, {} as Record<string, TopLevelEntry>)
}, {} as Record<string, TopLevelEntry>),
);
}, {} as Record<string, TopLevelEntry>);

Expand All @@ -573,41 +573,37 @@ type NextOrPrevious = { title?: string; category?: string; href?: string };

const getNextPreviousForEntry = (
language: SupportedLanguages,
entry: TopLevelEntry
entry: TopLevelEntry,
): NextOrPrevious => ({
href: `/docs/${language}/${entry.slug}`,
title: entry.title?.[language],
});

export const getNextAndPreviousPost = (
language: SupportedLanguages,
slug: string
slug: string,
) => {
const tableOfContentsEntries = tableOfContents.reduce((entries, cur) => {
return entries.concat(
[cur, ...(cur.children || [])].filter(({ slug }) => slug)
[cur, ...(cur.children || [])].filter(({ slug }) => slug),
);
}, [] as TopLevelEntry[]);

const currentIndex = tableOfContentsEntries.findLastIndex(
({ slug: currentSlug }) => currentSlug && slug.includes(currentSlug)
({ slug: currentSlug }) => currentSlug && slug.includes(currentSlug),
);

const previous =
currentIndex === 0
? undefined
: getNextPreviousForEntry(
language,
tableOfContentsEntries[currentIndex - 1]
);
const previous = currentIndex === 0 ? undefined : getNextPreviousForEntry(
language,
tableOfContentsEntries[currentIndex - 1],
);

const next =
currentIndex === tableOfContentsEntries.length - 1
? undefined
: getNextPreviousForEntry(
language,
tableOfContentsEntries[currentIndex + 1]
);
const next = currentIndex === tableOfContentsEntries.length - 1
? undefined
: getNextPreviousForEntry(
language,
tableOfContentsEntries[currentIndex + 1],
);

return {
previous,
Expand Down
Binary file added static/docs/creating-new-page/add-section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/docs/creating-new-page/pages-menu-pt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/docs/creating-new-page/pages-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8961a9b

Please sign in to comment.