mirror of
https://github.com/BillyOutlast/posthog.com.git
synced 2026-02-04 03:11:21 +01:00
Make docs overview pages the default file of their parent folder (fixes merge conflict) (#1681)
* move slug field creation to onCreateNode * update docs overview pages to support new URL structure * update redirects to support new URL structure * Update netlify.toml (#1629) * WIP Intro Post: Phil Leggetter (#1602) * Create intro-phil-leggetter.md * fixed a couple of typos and added more links * Update intro-phil-leggetter.md * Added Phil's location + link * Added gaming reference * Added Charles' changes * Uploaded feature image for Phil's intro * Add safe redirects * Added feature image Co-authored-by: James Hawkins <47497682+jamesefhawkins@users.noreply.github.com> Co-authored-by: PostHog <hey@posthog.com> * Add safe redirects * Remove conflict in blog post * handle default directory index files redirects in safe_rename * Replace /path/index with /path in safe redirects Co-authored-by: Eli Kinsey <ekinseydev@gmail.com> Co-authored-by: Mohammed Shehu <40317687+shehuphd@users.noreply.github.com> Co-authored-by: James Hawkins <47497682+jamesefhawkins@users.noreply.github.com> Co-authored-by: PostHog <hey@posthog.com>
This commit is contained in:
@@ -4,7 +4,7 @@ const { createFilePath } = require(`gatsby-source-filesystem`)
|
||||
|
||||
module.exports = exports.onCreateNode = ({ node, getNode, actions }) => {
|
||||
const { createNodeField } = actions
|
||||
if (node.internal.type === `MarkdownRemark`) {
|
||||
if (node.internal.type === `MarkdownRemark` || node.internal.type === 'Mdx') {
|
||||
const slug = createFilePath({ node, getNode, basePath: `pages` })
|
||||
createNodeField({
|
||||
node,
|
||||
|
||||
72
netlify.toml
72
netlify.toml
@@ -149,8 +149,8 @@
|
||||
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/plugins/build"
|
||||
to = "/docs/plugins/build/overview"
|
||||
from = "/docs/plugins/build/overview"
|
||||
to = "/docs/plugins/build"
|
||||
|
||||
|
||||
[[redirects]]
|
||||
@@ -181,25 +181,23 @@
|
||||
from = "/docs/updating-documentation"
|
||||
to = "/docs/contributing/updating-documentation"
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/self-host/configure/scaling-posthog"
|
||||
to = "/docs/self-host/overview"
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/configuring-posthog/scaling-posthog"
|
||||
to = "/docs/self-host/overview"
|
||||
to = "/docs/self-host"
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/self-host"
|
||||
to = "/docs/self-host/overview"
|
||||
from = "/docs/self-host/overview"
|
||||
to = "/docs/self-host"
|
||||
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/deployment"
|
||||
to = "/docs/self-host/overview#deploy"
|
||||
to = "/docs/self-host#deploy"
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/self-host/configure"
|
||||
to = "/docs/self-host/overview#configure"
|
||||
to = "/docs/self-host#configure"
|
||||
|
||||
[[redirects]]
|
||||
from = "/docs/configuring-posthog"
|
||||
@@ -214,10 +212,10 @@
|
||||
from = "/docs/contributing/developing-locally"
|
||||
to = "/docs/contribute/developing-locally"
|
||||
|
||||
# Added: 2021-07-13
|
||||
# Added: 2021-07-13 Updated: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/contributing"
|
||||
to = "/docs/contribute/overview"
|
||||
to = "/docs/contribute"
|
||||
|
||||
# Added: 2021-07-13
|
||||
[[redirects]]
|
||||
@@ -564,15 +562,15 @@
|
||||
from = "/docs/features/users"
|
||||
to = "/docs/user-guides/users"
|
||||
|
||||
# Added: 2021-07-13
|
||||
# Added: 2021-07-13 Updated: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/tutorials"
|
||||
to = "/docs/tutorials/overview"
|
||||
from = "/docs/tutorials/overview"
|
||||
to = "/docs/tutorials"
|
||||
|
||||
# Added: 2021-07-13
|
||||
# Added: 2021-07-13 Updated: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/features"
|
||||
to = "/docs/user-guides/overview"
|
||||
to = "/docs/user-guides"
|
||||
|
||||
# Added: 2021-07-13
|
||||
[[redirects]]
|
||||
@@ -585,20 +583,20 @@
|
||||
from = "/features"
|
||||
to = "/product"
|
||||
|
||||
# Added: 2021-07-16
|
||||
# Added: 2021-07-16 Updated: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/integrate"
|
||||
to = "/docs/integrate/overview"
|
||||
from = "/docs/integrate/overview"
|
||||
to = "/docs/integrate"
|
||||
|
||||
# Added: 2021-07-16
|
||||
# Added: 2021-07-16 Updated: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/integrations"
|
||||
to = "/docs/integrate/overview"
|
||||
to = "/docs/integrate"
|
||||
|
||||
# Added: 2021-07-16
|
||||
[[redirects]]
|
||||
from = "/docs/libraries"
|
||||
to = "/docs/integrate/overview"
|
||||
to = "/docs/integrate"
|
||||
|
||||
# Added: 2021-07-17
|
||||
# Not due to a rename, but to improve the website's navigation experience
|
||||
@@ -620,4 +618,30 @@
|
||||
# Added: 2021-07-28
|
||||
[[redirects]]
|
||||
from = "/docs/self-host/deploy/qovery"
|
||||
to = "/docs/self-host/deploy/other"
|
||||
to = "/docs/self-host/deploy/other"
|
||||
|
||||
# Added: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/plugins/overview"
|
||||
to = "/docs/plugins"
|
||||
|
||||
# Added: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/api/overview"
|
||||
to = "/docs/api"
|
||||
|
||||
# Added: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/contribute/overview"
|
||||
to = "/docs/contribute"
|
||||
|
||||
# Added: 2021-07-17
|
||||
[[redirects]]
|
||||
from = "/docs/user-guides/overview"
|
||||
to = "/docs/user-guides"
|
||||
|
||||
# Added: 2021-07-17
|
||||
# Not due to a rename, but to improve the website's navigation experience
|
||||
[[redirects]]
|
||||
from = "/signup"
|
||||
to = "/pricing"
|
||||
|
||||
@@ -33,12 +33,17 @@ try:
|
||||
|
||||
for i in range(len(from_paths)):
|
||||
md_to_mdx = '.mdx' not in from_paths[i] and '.mdx' in to_paths[i]
|
||||
|
||||
# handle index default directory files. /path/index will become /path
|
||||
to_paths[i] = re.sub("\/index$", "", to_paths[i])
|
||||
|
||||
new_redirect = redirect_text.format(from_paths[i], to_paths[i])
|
||||
|
||||
if not md_to_mdx and from_paths[i] != '(.*)' and new_redirect not in local_netlify_config_text:
|
||||
print("Creating redirect: ", new_redirect)
|
||||
new_redirects += redirect_with_date_comment_text.format(date.today(), new_redirect)
|
||||
else:
|
||||
print('Not including existing redirect:', new_redirect)
|
||||
print('Not including redirect:', new_redirect)
|
||||
|
||||
with open("./netlify.toml", "a") as netlify_config:
|
||||
netlify_config.write(new_redirects)
|
||||
|
||||
@@ -38,9 +38,11 @@ function SidebarContents() {
|
||||
}
|
||||
}
|
||||
}
|
||||
allMdx(sort: { order: ASC, fields: slug }) {
|
||||
allMdx(sort: { order: ASC, fields: [fields___slug] }) {
|
||||
nodes {
|
||||
slug
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
id
|
||||
frontmatter {
|
||||
title
|
||||
@@ -61,9 +63,8 @@ function SidebarContents() {
|
||||
}
|
||||
`}
|
||||
render={(data) => {
|
||||
const parsedMdxData = data.allMdx.nodes.map((node) => ({ ...node, fields: { slug: `/${node.slug}` } }))
|
||||
const entries = data.allSidebarsJson.nodes
|
||||
const pages = [...data.allMarkdownRemark.nodes, ...parsedMdxData]
|
||||
const pages = [...data.allMarkdownRemark.nodes, ...data.allMdx.nodes]
|
||||
let dir = []
|
||||
let tree = null
|
||||
let defaultOpenKeys = []
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
"entry": "Self-Host",
|
||||
"name": "Self-Host",
|
||||
"items": ["docs/self-host/overview", "docs/self-host/postgres-vs-clickhouse"],
|
||||
"items": ["docs/self-host", "docs/self-host/postgres-vs-clickhouse"],
|
||||
"child_entries": ["Deploy (Postgres)", "Configure"]
|
||||
},
|
||||
{
|
||||
@@ -40,7 +40,7 @@
|
||||
{
|
||||
"entry": "Integrate",
|
||||
"name": "Integrate",
|
||||
"items": ["docs/integrate/overview"],
|
||||
"items": ["docs/integrate"],
|
||||
"child_entries": ["Client Libraries", "Server Libraries", "Third Party", "Webhooks"]
|
||||
},
|
||||
{
|
||||
@@ -97,7 +97,7 @@
|
||||
"entry": "User Guides",
|
||||
"name": "User Guides",
|
||||
"items": [
|
||||
"docs/user-guides/overview",
|
||||
"docs/user-guides",
|
||||
"docs/user-guides/application-settings",
|
||||
"docs/user-guides/actions",
|
||||
"docs/user-guides/annotations",
|
||||
@@ -122,14 +122,14 @@
|
||||
{
|
||||
"entry": "Plugins",
|
||||
"name": "Plugins",
|
||||
"items": ["docs/plugins/overview", "docs/plugins/enabling"],
|
||||
"items": ["docs/plugins", "docs/plugins/enabling"],
|
||||
"child_entries": ["Build Your Own"]
|
||||
},
|
||||
{
|
||||
"entry": "Build Your Own",
|
||||
"name": "Build Your Own",
|
||||
"items": [
|
||||
"docs/plugins/build/overview",
|
||||
"docs/plugins/build",
|
||||
"docs/plugins/build/tutorial",
|
||||
"docs/plugins/build/types",
|
||||
"docs/plugins/build/reference"
|
||||
@@ -139,7 +139,7 @@
|
||||
"entry": "Tutorials",
|
||||
"name": "Tutorials",
|
||||
"items": [
|
||||
"docs/tutorials/overview",
|
||||
"docs/tutorials",
|
||||
"docs/tutorials/feature-flags",
|
||||
"docs/tutorials/toolbar",
|
||||
"docs/tutorials/funnels",
|
||||
@@ -158,7 +158,7 @@
|
||||
"entry": "API",
|
||||
"name": "API",
|
||||
"items": [
|
||||
"docs/api/overview",
|
||||
"docs/api",
|
||||
"docs/api/post-only-endpoints",
|
||||
"docs/api/elements",
|
||||
"docs/api/events",
|
||||
@@ -175,7 +175,7 @@
|
||||
"entry": "Contribute",
|
||||
"name": "Contribute",
|
||||
"items": [
|
||||
"docs/contribute/overview",
|
||||
"docs/contribute",
|
||||
"docs/contribute/code-of-conduct",
|
||||
"docs/contribute/recognizing-contributions",
|
||||
"docs/contribute/developing-locally",
|
||||
|
||||
Reference in New Issue
Block a user