Skip to content

Commit

Permalink
Merge pull request #124 from morganstanley/page-head-component
Browse files Browse the repository at this point in the history
Page head component
  • Loading branch information
aidanm3341 authored Oct 31, 2024
2 parents f70f908 + 3036532 commit 12acb94
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 107 deletions.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# MessageBroker

![Lifecycle Active](https://badgen.net/badge/Lifecycle/Active/green)
![NPM](https://img.shields.io/npm/l/@morgan-stanley/message-broker)
![npm](https://img.shields.io/npm/v/@morgan-stanley/message-broker)
Expand All @@ -8,7 +9,7 @@

MessageBroker provides framework agnostic, decoupled communication between publishers and subscribers. This library is fully type safe and works in both browsers and Node.js. MessageBroker is built ontop of [RxJS](https://rxjs.dev/guide/overview) providing access to observables and a comprehensive list of operators.

Full documentation can be found at http://opensource.morganstanley.com/message-broker/
Full documentation can be found at https://morganstanley.github.io/message-broker/

## Basic Usage

Expand Down
8 changes: 4 additions & 4 deletions site/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { plugins } = require('./src/config/base-gatsby-plugins');

module.exports = {
siteMetadata: {
title: `Project GitHub Pages Template`,
description: `Morgan Stanley Open Source Software`,
siteUrl: 'http://opensource.morganstanley.com',
title: `Message Broker`,
description: `a Typescript library which aims to provide asynchronous communication between typescript components`,
siteUrl: 'https://morganstanley.github.io',
documentationUrl: false,
// documentationUrl: url-of.documentation.site,
},
pathPrefix: `/`, // put GitHub project url slug here e.g. github.com/morganstanley/<project url slug>
pathPrefix: `/message-broker`, // put GitHub project url slug here e.g. github.com/morganstanley/<project url slug>
plugins,
};
15 changes: 7 additions & 8 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Header = ({ location, links }) => {
return (
<div className="content">
<h1 className="logo">
<Link className="logo-link" to={`//opensource.morganstanley.com`}>
<Link className="logo-link" to={`//morganstanley.github.io`}>
<StaticImage
width={267}
src="../images/logo-black.png"
Expand Down
12 changes: 12 additions & 0 deletions site/src/components/page-head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

function PageHead({ title, children }) {
return (
<>
<title>{title} | Morgan Stanley</title>
{children}
</>
);
}

export default PageHead;
71 changes: 0 additions & 71 deletions site/src/components/seo.js

This file was deleted.

6 changes: 5 additions & 1 deletion site/src/pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { graphql } from 'gatsby';

import Hero from '../components/hero';
import Layout from '../components/layout';
import PageHead from '../components/page-head';

const NotFoundPage = ({ data, location }) => {
return (
Expand All @@ -18,7 +19,10 @@ const NotFoundPage = ({ data, location }) => {

export default NotFoundPage;

export const Head = () => <title>404: Not Found</title>;
export const Head = ({ data }) => {
const title = `404: Not Found | ${data.site.siteMetadata.title}`;
return <PageHead title={title} />;
};

export const pageQuery = graphql`
query {
Expand Down
8 changes: 6 additions & 2 deletions site/src/pages/documentation/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useCallback, useState } from 'react';
import { Link, graphql } from 'gatsby';
import Box from '@mui/material/Box';
import Toolbar from '@mui/material/Toolbar';

import PageHead from '../../components/page-head';
import Layout from '../../components/layout';
import VersionSelect from '../../components/version-select';
import { getDocsVersion } from '../../utils/version-docs';

import HeroContent from '../../../content/hero.mdx';
import { Toolbar } from '@mui/material';

const DocumentationIndex = ({ data, location }) => {
const allDocs = data.allMdx.nodes;
Expand Down Expand Up @@ -66,7 +67,10 @@ const DocumentationIndex = ({ data, location }) => {

export default DocumentationIndex;

export const Head = () => <title>Documentation</title>;
export const Head = ({ data }) => {
const title = `Documentation | ${data.site.siteMetadata.title}`;
return <PageHead title={title} />;
};

export const pageQuery = graphql`
query {
Expand Down
5 changes: 5 additions & 0 deletions site/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import HeroContent from '../../content/hero.mdx';
import UseCases from '../../content/use-cases.mdx';

import Article from '../components/article';
import PageHead from '../components/page-head';
import Layout from '../components/layout';

const SiteIndex = ({ data, location }) => {
Expand All @@ -34,6 +35,10 @@ const SiteIndex = ({ data, location }) => {
);
};

export const Head = ({ data }) => (
<PageHead title={data.site.siteMetadata.title} />
);

export default SiteIndex;

export const pageQuery = graphql`
Expand Down
5 changes: 4 additions & 1 deletion site/src/pages/news/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Link, graphql } from 'gatsby';

import Layout from '../../components/layout';
import PageHead from '../../components/page-head';

import HeroContent from '../../../content/hero.mdx';

Expand Down Expand Up @@ -32,7 +33,9 @@ const NewsIndex = ({ data, location }) => {

export default NewsIndex;

export const Head = () => <title>News</title>;
export const Head = ({ data }) => (
<PageHead title={data.site.siteMetadata.title} />
);

export const pageQuery = graphql`
query {
Expand Down
15 changes: 9 additions & 6 deletions site/src/templates/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link, navigate, graphql } from 'gatsby';
import { Box } from '@mui/material';

import Layout from '../components/layout';
import PageHead from '../components/page-head';
import VersionSelect from '../components/version-select';
import { getCurrentVersion, getDocsVersion } from '../utils/version-docs';

Expand Down Expand Up @@ -83,12 +84,14 @@ const DocumentationTemplate = ({ children, data, pageContext, location }) => {

export default DocumentationTemplate;

export const Head = ({ pageContext }) => (
<>
<title>{pageContext.frontmatter.title}</title>
<meta name="description" content={pageContext.description} />
</>
);
export const Head = ({ data, pageContext }) => {
const title = `${pageContext.frontmatter.title} | ${data.site.siteMetadata.title}`;
return (
<PageHead title={title}>
<meta name="description" content={pageContext.description} />
</PageHead>
);
};

export const pageQuery = graphql`
query ($id: String!) {
Expand Down
15 changes: 9 additions & 6 deletions site/src/templates/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { graphql } from 'gatsby';

import Layout from '../components/layout';
import PageHead from '../components/page-head';
import Section from '../components/section';

const NewsPostTemplate = ({ children, data, pageContext, location }) => {
Expand All @@ -24,12 +25,14 @@ const NewsPostTemplate = ({ children, data, pageContext, location }) => {

export default NewsPostTemplate;

export const Head = ({ pageContext }) => (
<>
<title>{pageContext.title}</title>
<meta name="description" content={pageContext.description} />
</>
);
export const Head = ({ data, pageContext }) => {
const title = `${pageContext.frontmatter.title} | ${data.site.siteMetadata.title}`;
return (
<PageHead title={title}>
<meta name="description" content={pageContext.description} />
</PageHead>
);
};

export const pageQuery = graphql`
query ($id: String!) {
Expand Down
15 changes: 9 additions & 6 deletions site/src/templates/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { graphql } from 'gatsby';

import Layout from '../components/layout';
import PageHead from '../components/page-head';

const PageTemplate = ({ title, data, location, children }) => {
return (
Expand All @@ -18,12 +19,14 @@ const PageTemplate = ({ title, data, location, children }) => {

export default PageTemplate;

export const Head = ({ pageContext }) => (
<>
<title>{pageContext.title}</title>
<meta name="description" content={pageContext.description} />
</>
);
export const Head = ({ data, pageContext }) => {
const title = `${pageContext.frontmatter.title} | ${data.site.siteMetadata.title}`;
return (
<PageHead title={title}>
<meta name="description" content={pageContext.description} />
</PageHead>
);
};

export const pageQuery = graphql`
query ($id: String!) {
Expand Down

0 comments on commit 12acb94

Please sign in to comment.