File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
examples/astro/previews/example-app/src/pages/wp-templates Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 11---
22import Layout from " ../../layouts/Layout.astro" ;
33import { authHeaders , client , gql } from " ../../lib/client" ;
4+
45/**
56 * This is a template for the WordPress template hierarchy.
67 * It will be used to render the WordPress templates.
78 * It should never be used directly.
89 * This check confirms that the template is being used in the correct context.
910 * If the template is being used directly, it will redirect to the 404 page.
10- *
11- * Once https://github.com/withastro/astro/issues/13555 is fixed, this check can be changed to:
12- * if (Astro.url.pathname === Astro.originPathname)
13- *
1411 */
1512if (Astro .url .pathname === Astro .originPathname ) {
1613 return Astro .rewrite (" /404" );
Original file line number Diff line number Diff line change 55 * It should never be used directly.
66 * This check confirms that the template is being used in the correct context.
77 * If the template is being used directly, it will redirect to the 404 page.
8- *
9- * Once https://github.com/withastro/astro/issues/13555 is fixed, this check can be changed to:
10- * if (Astro.url.pathname === Astro.originPathname)
11- *
128 */
139if (Astro .url .pathname === Astro .originPathname ) {
1410 return Astro .rewrite (" /404" );
@@ -21,7 +17,7 @@ const databaseId = Astro.locals.templateData?.databaseId;
2117const isPreview = Astro .locals .isPreview ;
2218
2319const query = gql `
24- query indexTemplateNodeQuery($id: ID!, $isPreview: Boolean! ) {
20+ query indexTemplateNodeQuery($id: ID!, $isPreview: Boolean = false ) {
2521 node: contentNode(id: $id, idType: DATABASE_ID, asPreview: $isPreview) {
2622 __typename
2723 uri
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ const databaseId = Astro.locals.templateData?.databaseId;
1717
1818const { data, error } = await client .query (
1919 gql `
20- query singleTemplatePageQuery($databaseId: ID!, $isPreview: Boolean!) {
20+ query singleTemplatePageQuery(
21+ $databaseId: ID!
22+ $isPreview: Boolean = false
23+ ) {
2124 post: contentNode(
2225 id: $databaseId
2326 idType: DATABASE_ID
You can’t perform that action at this time.
0 commit comments