Skip to content

Commit

Permalink
Refactor HEAD and add schema information (#648)
Browse files Browse the repository at this point in the history
fixed #647

Signed-off-by: Jonas Helming <[email protected]>
  • Loading branch information
JonasHelming authored Nov 8, 2024
1 parent dc8171f commit e7f5825
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 94 deletions.
1 change: 0 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = {
},
plugins: [
'gatsby-plugin-emotion',
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-source-filesystem',
options: {
Expand Down
53 changes: 0 additions & 53 deletions package-lock.json

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

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
"@babel/core": "^7.26.0",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@types/react-helmet": "^6.1.11",
"env-cmd": "^10.1.0",
"gatsby": "^5.13.7",
"gatsby-plugin-catch-links": "^5.13.1",
"gatsby-plugin-emotion": "^8.13.1",
"gatsby-plugin-react-helmet": "^6.13.1",
"gatsby-remark-autolink-headers": "^6.13.1",
"gatsby-remark-external-links": "0.0.4",
"gatsby-remark-prismjs": "^7.13.2",
Expand All @@ -32,7 +30,6 @@
"prismjs": "^1.29.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet": "^6.1.0",
"react-tweet-embed": "^2.0.0",
"react-twitter-embed": "^4.0.4",
"reactjs-popup": "^2.0.6",
Expand Down
26 changes: 26 additions & 0 deletions src/layouts/basehead.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'
import useSiteMetadata from '../hooks/use-site-metadata'
import AppleTouchIcon from '../resources/apple-touch-icon.png'
import Favicon from '../resources/theia-favicon.svg'
import Favicon196 from '../resources/theia-favicon-196x196.png'

const BaseHead = ({ canonical }) => {
const { title, description } = useSiteMetadata()
return (
<>
<html lang="en" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#FFFFFF" />
{canonical && <link rel="canonical" href={`https://theia-ide.org${canonical}`} />}
<link rel="apple-touch-icon" type="image/png" href={AppleTouchIcon} sizes="180x180" />
<link rel="icon" type="image/png" href={Favicon196} sizes="196x196" />
<link rel="icon" type="image/svg+xml" href={Favicon} sizes="any" />
<link href="https://fonts.googleapis.com/css?family=Anonymous+Pro&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500&display=swap" rel="stylesheet" />
</>
)
}

export default BaseHead
94 changes: 94 additions & 0 deletions src/layouts/headwithschema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React from 'react'
import BaseHead from './basehead'

const HeadWithSchema = ({ canonical }) => (
<>
<BaseHead canonical={canonical} />
{/* JSON-LD for Theia IDE */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Theia IDE",
"url": "https://theia-ide.org/#theiaide",
"image": "https://theia-ide.org/static/TheiaIDE.png",
"description": "Theia IDE is a modern, open-source, and flexible development environment (IDE) for developers on desktop and browser, featuring advanced AI-powered capabilities with full control over AI interactions.",
"operatingSystem": "Linux, macOS, Windows",
"applicationCategory": "DeveloperApplication",
"applicationSubCategory": "IntegratedDevelopmentEnvironment",
"softwareVersion": "1.55.0",
"softwareRequirements": "Compatible with VS Code extensions",
"author": {
"@type": "Organization",
"name": "Eclipse Foundation",
"url": "https://www.eclipse.org/"
},
"publisher": {
"@type": "Organization",
"name": "Eclipse Foundation",
"url": "https://www.eclipse.org/"
},
"releaseNotes": "https://eclipsesource.com/blogs/2024/11/07/eclipse-theia-1-54-release-news-and-noteworthy/",
"keywords": [
"open-source IDE",
"development environment",
"AI-powered IDE",
"VS Code extensions",
"VS Code alternative"
],
"license": "Eclipse Public License 2.0",
"featureList": [
"AI-powered",
"Open-source",
"Compatible with VS Code extensions",
"Cross-platform support",
"Runs in browser and desktop environments"
]
})
}}
/>
{/* JSON-LD for Theia Platform */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Theia Platform",
"url": "https://theia-ide.org/",
"image": "https://theia-ide.org/static/TheiaPlatform.png",
"description": "Theia Platform is an extensible open-source framework for building customizable integrated development environments (IDEs) for desktop and web.",
"applicationCategory": "DeveloperApplication",
"applicationSubCategory": "FrameworkApplication",
"softwareRequirements": "Compatible with VS Code extensions",
"operatingSystem": "Linux, macOS, Windows",
"author": {
"@type": "Organization",
"name": "Eclipse Foundation",
"url": "https://www.eclipse.org/"
},
"publisher": {
"@type": "Organization",
"name": "Eclipse Foundation",
"url": "https://www.eclipse.org/"
},
"keywords": [
"custom IDE", "build custom IDE", "custom IDE Framework",
"alternative VS Code", "alternative Code OSS", "build custom tool",
"custom tool framework"
],
"license": "Eclipse Public License 2.0",
"featureList": [
"AI-powered", "Open-source", "Build tailored IDEs and Tools",
"Cross-platform support", "VS Code extension compatibility",
"Desktop, browser and cloud support"
]
})
}}
/>
</>
)

export default HeadWithSchema
48 changes: 11 additions & 37 deletions src/layouts/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@

import React from 'react'
import { Global, css } from '@emotion/react'
import Helmet from 'react-helmet'
import useSiteMetadata from '../hooks/use-site-metadata'
import { fontSizes, colors, grid, breakpoints } from '../utils/variables'
import Favicon from '../resources/theia-favicon.svg'
import Favicon196 from '../resources/theia-favicon-196x196.png'
import AppleTouchIcon from '../resources/apple-touch-icon.png'
const Layout = ({ children }) => (
<>
<Global styles={css`

const Layout = ({ children, canonical }) => {
const { title, description } = useSiteMetadata()
return (
<>
<Global styles={css`
/* --------------------------------------------- */
/* ----- Basic Setup ----- */
/* --------------------------------------------- */
Expand Down Expand Up @@ -191,29 +183,11 @@ const Layout = ({ children, canonical }) => {
border: 1px solid #cfcece;
outline: none;
}
`} />
<Helmet>
<html lang='en' />
<title>{title}</title>
<meta name='description' content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#FFFFFF" />
{
canonical ? <link rel="canonical" href={`https://theia-ide.org${canonical}`} /> : null
}
<link rel="apple-touch-icon" type="image/png" href={AppleTouchIcon} sizes="180x180"/>
<link rel="icon" type="image/png" href={Favicon196} sizes="196x196"/>
<link rel="icon" type="image/svg+xml" href={Favicon} sizes="any"/>
<link href="https://fonts.googleapis.com/css?family=Anonymous+Pro&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500&display=swap" rel="stylesheet" />
</Helmet>
<>
{children}
</>
</>
)
}

export default Layout
`} />
<>
{children}
</>
</>
)

export default Layout
3 changes: 3 additions & 0 deletions src/pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import styled from '@emotion/styled'
import { breakpoints } from '../utils/variables'
import Nav from '../components/Nav'
import { Link } from 'gatsby'
import BaseHead from '../layouts/basehead'

const StyledNotFoundPage = styled.div`
background-image: url(${Background});
Expand Down Expand Up @@ -63,6 +64,8 @@ const StyledNotFoundPage = styled.div`
}
`
export const Head = BaseHead


const NotFoundPage = () => (
<Layout>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/blogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import React from 'react'
import Layout from '../layouts/layout'
import Blogs from '../components/Blogs'
import Footer from '../components/Footer'
import BaseHead from '../layouts/basehead'


export const Head = BaseHead


export default () => {
return (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import React from 'react'
import DocsLayout from '../layouts/docs-layout'
import { graphql } from 'gatsby'
import BaseHead from '../layouts/basehead'

export const query = graphql`
query {
Expand All @@ -31,6 +32,7 @@ export const query = graphql`
}
}
`
export const Head = BaseHead

const Docs = ({ data }) => {
const context = { next: "/docs/architecture/", nextTitle: "Architecture Overview" }
Expand Down
2 changes: 2 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import TheiaIDEHeader from '../components/index/TheiaIDEHeader'
import VSCodeExtensions from '../components/index/VSCodeExtensions'
import TheiaIDEDownloads from '../components/index/TheiaIDEDownloads'
import TheiaIDEExtensible from '../components/index/TheiaIDEExtensible'
import HeadWithSchema from '../layouts/headwithschema'

export const Head = HeadWithSchema

export default ({ pageContext }) => {
return (
Expand Down
3 changes: 3 additions & 0 deletions src/pages/releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import React from 'react'
import Layout from '../layouts/layout'
import Releases from '../components/Releases'
import Footer from '../components/Footer'
import BaseHead from '../layouts/basehead'

export const Head = BaseHead

export default () => {
return (
Expand Down
3 changes: 3 additions & 0 deletions src/pages/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import React from 'react'
import Layout from '../layouts/layout'
import Resources from '../components/Resources'
import Footer from '../components/Footer'
import BaseHead from '../layouts/basehead'

export const Head = BaseHead

export default () => {
return (
Expand Down
4 changes: 4 additions & 0 deletions src/pages/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import React from 'react'
import Layout from '../layouts/layout'
import Support from '../components/Support'
import Footer from '../components/Footer'
import BaseHead from '../layouts/basehead'


export const Head = BaseHead

export default () => {
return (
Expand Down
Loading

0 comments on commit e7f5825

Please sign in to comment.