Skip to content

Commit

Permalink
Merge branch 'release/4.0.38' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jan 22, 2024
2 parents 1742ce1 + 4e43002 commit 2508dd5
Show file tree
Hide file tree
Showing 46 changed files with 4,484 additions and 5,324 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build and Deploy Docs
env:
DOCS_DEST_DIR: /seomatic/
DOCS_DEST_DIR: /seomatic/v4/
on:
push:
branches:
Expand All @@ -22,11 +22,11 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [ 14.x ]
node-version: [ 20.x ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand Down
2,568 changes: 8 additions & 2,560 deletions CHANGELOG.md

Large diffs are not rendered by default.

1,083 changes: 741 additions & 342 deletions buildchain/package-lock.json

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-seomatic",
"description": "SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 4. It is a turnkey SEO system that is comprehensive, powerful, and flexible.",
"type": "craft-plugin",
"version": "4.0.37",
"version": "4.0.38",
"keywords": [
"craft",
"cms",
Expand Down
4 changes: 2 additions & 2 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TAG=14-alpine
ARG TAG=20-alpine
FROM node:$TAG

USER node
RUN npm install -g npm@^10.0.0

WORKDIR /app/

Expand Down
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MAJOR_VERSION?=4
TAG?=14-alpine
TAG?=20-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-docs
DOCS_DEV_PORT?=400${MAJOR_VERSION}
DOCS_DEST?=../../../sites/nystudio107/web/docs/seomatic
DOCS_DEST?=../../../sites/nystudio107/web/docs/seomatic/v4
IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG))
IMAGE_NAME=${CONTAINER}:${TAG}
DOCKER_RUN=docker container run --rm -it -v "${CURDIR}":/app
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {defineConfig} from 'vitepress'
export default defineConfig({
title: 'SEOmatic Plugin',
description: 'Documentation for the SEOmatic plugin',
base: '/docs/seomatic/',
base: '/docs/seomatic/v4/',
lang: 'en-US',
head: [
['meta', {content: 'https://github.com/nystudio107', property: 'og:see_also',}],
Expand Down Expand Up @@ -50,6 +50,7 @@ export default defineConfig({
{text: 'Issues', link: 'https://github.com/nystudio107/craft-seomatic/issues'},
{
text: 'v4', items: [
{text: 'v5', link: 'https://nystudio107.com/docs/seomatic/'},
{text: 'v4', link: '/'},
{text: 'v3', link: 'https://nystudio107.com/docs/seomatic/v3/'},
],
Expand Down
1 change: 0 additions & 1 deletion docs/docs/@types/sitemap-plugin.d.ts

This file was deleted.

135 changes: 47 additions & 88 deletions docs/docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ SEOmatic allows you to fetch the meta information for any page via a controller

### GraphQL Query support

To retrieve SEOmatic container data through the native [GraphQL in Craft CMS 3.3](https://docs.craftcms.com/v3/graphql.html#sending-api-requests) or the [CraftQL plugin](https://github.com/markhuot/craftql), use the `seomatic` field in your GraphQL query. Each parameter will return that container’s data, ready for insertion into the DOM.
To retrieve SEOmatic container data through [GraphQL in Craft CMS 4](https://craftcms.com/docs/4.x/graphql.html#sending-api-requests), use the `seomatic` field in your GraphQL query. Each parameter will return that container’s data, ready for insertion into the DOM.

#### Stand-alone GraphQL queries

You must as least pass in the URI you want metadata for:

Expand Down Expand Up @@ -295,6 +297,50 @@ Valid values are `local` for local development, `staging` for staging, and `live

![Screenshot](./resources/screenshots/seomatic-craftql-query.png)

#### Piggybacking GraphQL queries

You can also piggyback on an entries query, to return all of your data for an entry as well as the SEOmatic metadata in one request.

Craft CMS GraphQL:

```graphql
{
entry(section: "homepage") {
id
title
seomatic {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
metaSiteVarsContainer
}
}
}
```

In this case, no arguments are passed in, because the URI and siteId will be taken from the parent Entry element. But you can pass in the `asArray` argument too:

Craft CMS GraphQL:

```graphql
{
entry(section: "homepage") {
id
title
seomatic(asArray: true) {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
metaSiteVarsContainer
}
}
}
```

### Frontend Templates GraphQL queries

SEOmatic an provide you with the frontend templates such as `robots.txt`, `humans.txt`, etc. as well:
Expand Down Expand Up @@ -391,93 +437,6 @@ SEOmatic also allows you to query for `sitemapStyles`:

This returns the [XSL stylesheet](https://www.w3.org/Style/XSL/WhatIsXSL.html) that SEOmatic uses to make the sitemaps pleasant for humans to read.

#### Piggybacking GraphQL queries

You can also piggyback on an entries query, to return all of your data for an entry as well as the SEOmatic metadata in one request.

**N.B.:** This requires using either Craft CMS 3.4 or later, or the CraftQL plugin to work.

Native Craft CMS GraphQL:

```graphql
{
entry(section: "homepage") {
id
title
seomatic {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
metaSiteVarsContainer
}
}
}
```

CraftQL Plugin:

```graphql
{
entry(section: homepage) {
id
title
... on Homepage {
seomatic {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
}
}
}
}
```

In this case, no arguments are passed in, because the URI and siteId will be taken from the parent Entry element. But you can pass in the `asArray` argument too:

Native Craft CMS GraphQL:

```graphql
{
entry(section: "homepage") {
id
title
seomatic(asArray: true) {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
metaSiteVarsContainer
}
}
}
```

CraftQL Plugin:

```graphql
{
entry(section: homepage) {
id
title
... on Homepage {
seomatic(asArray: true) {
metaTitleContainer
metaTagContainer
metaLinkContainer
metaScriptContainer
metaJsonLdContainer
}
}
}
}
```


### Meta Container API Endpoints

**N.B.:** Anonymous access to the Meta Container endpoints are disabled by default; you’ll need to enable them in SEOmatic → Plugin Settings → Endpoints
Expand Down
19 changes: 9 additions & 10 deletions docs/docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import {defineConfig} from 'vite'
import SitemapPlugin from 'rollup-plugin-sitemap'
import { sitemap, Url as SitemapUrl } from '@aminnairi/rollup-plugin-sitemap'
import VitePressConfig from './.vitepress/config'
import {DefaultTheme} from "vitepress/types/default-theme";

const docsSiteBaseUrl = 'https://nystudio107.com'
const docsBaseUrl = new URL(VitePressConfig.base!, docsSiteBaseUrl).href.replace(/\/$/, '') + '/';
let siteMapRoutes: SiteMapPluginUrls = [];
let siteMapUrls: SitemapUrl[] = [];
if (Array.isArray(VitePressConfig.themeConfig?.sidebar)) {
siteMapRoutes = VitePressConfig.themeConfig?.sidebar?.map((group: DefaultTheme.SidebarItem) => {
return group.items!.map((items: DefaultTheme.SidebarItem) => ({
path: items.link!.replace(/^\/+/, '') ?? '',
name: items.text ?? ''
siteMapUrls = VitePressConfig.themeConfig?.sidebar?.map((group: DefaultTheme.SidebarItem) => {
return group.items!.map((items: DefaultTheme.SidebarItem) => (<SitemapUrl>{
location: items.link!.replace(/^\/+/, '') ?? '',
lastModified: new Date(),
}));
}).reduce((prev: SiteMapPluginUrls, curr: SiteMapPluginUrls) => {
}).reduce((prev: SitemapUrl[], curr: SitemapUrl[]) => {
return prev!.concat(curr!);
});
}

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
SitemapPlugin({
sitemap({
baseUrl: docsBaseUrl,
contentBase: './docs/.vitepress/dist',
routes: siteMapRoutes,
urls: siteMapUrls,
})
],
server: {
Expand Down
Loading

0 comments on commit 2508dd5

Please sign in to comment.