ethereum / ethereum-org-website
- вторник, 12 октября 2021 г. в 00:38:19
Ethereum.org is a primary online resource for the Ethereum community.
This is the repo for the ethereum.org website, a resource for the Ethereum community. The purpose of the site is to “Be the best portal to Ethereum for our growing global community" - read more about what this means here.
ethereum.org is improved and changed over time through the contributions of community members who submit content, give feedback, or volunteer their time to managing its evolution. If you’re interested in helping to improve ethereum.org, find out how to contribute.
If you're looking for the Ethereum blockchain itself, there is no single repo. Instead, Ethereum has multiple implementations of the protocol written in different programming languages for security and diversity. Check out the different implementations
This project follows the all-contributors specification. Contributions of any kind welcome!
If you're ready to contribute and create your PR, it will help to set up a local environment so you can see your changes.
Clone your fork
If this is your first time forking our repo, this is all you need to do for this step:
$ git clone git@github.com:[your_github_handle]/ethereum-org-website.git && cd ethereum-org-website
If you've already forked the repo, you'll want to ensure your fork is configured and that it's up to date. This will save you the headache of potential merge conflicts.
$ git remote add upstream https://github.com/ethereum/ethereum-org-website.git
To sync your fork with the latest changes:
$ git checkout dev
$ git fetch upstream
$ git merge upstream/dev
$ yarn
We recommend setting this up when running the project locally, as we use the GitHub API to fetch repository data for many projects & files.
- Follow these instructions to create a personal GitHub API token
- When selecting scopes in step 7, leave everything unchecked (the data we fetch doesn't require any scope)
- In local repo root directory: Make a copy of
.env.example
and name it.env
- Copy & paste your new GitHub API token into
.env
// .env Example:
GATSBY_GITHUB_TOKEN_READ_ONLY=48f84de812090000demo00000000697cf6e6a059
- Create an account on Etherscan
- Navigate to your Account Settings page
- In the sidebar, click on 'API-KEYs' and add a new token
- Copy & paste your Api-Key Token from Etherscan into
.env
// .env Example:
ETHERSCAN_API_KEY=K6NUTARFJZJCIXHF1F1E1YGJZ8RQ29BE4U
- Follow this guide to create an account and get your DeFiPulse API token
- Copy & paste your Active API Key from DeFiPulse into
.env
// .env Example:
DEFI_PULSE_API_KEY=4953aaf7966dad9c129397e197a0630ed0594f66962dd5fb058972b250da
$ git checkout -b new_branch_name
$ yarn start
localhost:8000
from your browserpackage.json
for more build options$ git commit -m "brief description of changes [Fixes #1234]"
$ git push
dev
branch of the ethereum/ethereum-org-website
repoUpdates out of date content [Fixes #1234]
dev
branchmaster
is continually synced to Netlify and will automatically deploy new commits to ethereum.orgdev
into master
(typically multiple times per week)The Translation Program is an initiative to translate ethereum.org into different languages and make the website accessible to people from all over the world.
If you are looking to get involved as a translator, you can join our project in Crowdin and start translating the website to your language immediately.
To get more information about the program, learn how to use Crowdin, check on the progress or find some useful tools for translators, please visit the Translation Program page.
gatsby-node.js
, gatsby-browser.js
, gatsby-config.js
, and gatsby-ssr.js
/src/components/Search/index.js
master
build. Also provides automatic preview deployments for all pull requestsFolder | Primary use |
---|---|
/src |
Main source folder for development |
/src/assets |
Image assets |
/src/components |
React components that do not function as stand alone pages |
/src/content |
Markdown/MDX files for site content stored here. For example: ethereum.org/en/about/ is built from src/content/about/index.md The markdown files are parsed and rendered by src/templates/static.js * |
/src/content/developers/docs |
*Markdown files in here use the Docs template: src/templates/docs.js |
/src/content/developers/tutorials |
*Markdown files in here use the Tutorial template: src/templates/tutorial.js |
/src/data |
General data files importable by components |
/src/hooks |
Custom React hooks |
/src/intl |
Language translation JSON files |
/src/lambda |
Lambda function scripts for API calls |
/src/pages /src/pages-conditional |
React components that function as stand alone pages. For example: ethereum.org/en/wallets/find-wallet is built from src/pages/wallets/find-wallet.js |
/src/scripts /src/utils |
Custom utility scripts |
/src/styles |
Stores layout.css which contains root level css styling |
/src/templates |
JSX templates that define layouts of differnt regions of the site |
/src/theme.js |
Declares site color themes, breakpoints and other constants (try to utilize these colors first) |
Please read carefully if adding or altering any written language content
How to prepare your content for translation depends on whether you're working on a simple Markdown/MDX page or a React component page.
- MDX pages (/src/content/page/
)
Markdown will be translated as whole pages of content, so no specific action is required. Simply create a new folder within /src/content/
with the name of the page, then place index markdown file (ie. index.md
) within new folder.
- React component page
English text should be placed into /src/intl/en/page-CORRESPONDING-PAGE.json
Crowdin is the platform we use to manage & crowdsource translation efforts. Please use the following conventions to help streamline this process.
Use kebab casing (utilizing-dashes-between-words) for file names and JSON keys
Use standard sentence casing for entry values
JSON `"page-warning": "Be very careful"`
CSS `text-transform: uppercase`
JSON `"page-warning": "BE VERY CAREFUL"`
Please avoid embedding links within a sentence. For a word/phrase to be a link, it requires a key/string in the intl JSON. If this is in the middle of another sentence, this results in the sentence being broken into multiple pieces, and requires coding the sentence structure into the JavaScript.
<p>All Ethereum transactions require a fee, known as Gas, that gets paid to the miner. <Link to="link">More on Gas</Link></p>
Once, you've addded your English content to the appropriate JSON file, the above code should look something more like:
<p><Translation id="page-transactions" />{" "}<Link to="link"><Translation id="page-transactions-gas-link" /></Link></p>
This is done using the Translation
component. However there is an alternative method for regular JS: gatsby-plugin-intl
with /src/utils/translations.js
Method one: <Translation />
component (preferred if only needed in JSX)
import { Translation } from "src/components/Translation"
// Utilize in JSX using
<Translation id="language-json-key" />
Method two: translateMessageId()
import { useIntl } from "gatsby-plugin-intl"
import { translateMessageId } from "src/utils/translations"
// Utilize anywhere in JS using
const intl = useIntl()
translateMessageId("language-json-key", intl)
const siteTitle = translateMessageId("site-title", intl)
// Example
import React, { useState, useEffect } from 'react'
const ComponentName = props => {
// useState hook for managing state variables
const [greeting, setGreeting] = useState('')
useEffect(() => {
// useEffect hook for handling component lifecycle
setGreeting('Hello world')
}, [])
return <div>{greeting}</div>
};
export default ComponentName;
src/theme.js
- Declares site color themes, breakpoints and other constants (try to utilize these colors first)
We use styled-components
// Example of styling syntax using styled-components
import styled from "styled-components"
const GenericButton = styled.div`
width: 200px;
height: 50px;
`
const PrimaryButton = styled(GenericButton)`
background: blue;
`
const SecondaryButton = styled(GenericButton)`
background: red;
`
// These are each components, capitalized by convention, and can be used within JSX code
// ie: <PrimaryButton>Text</PrimaryButton>
vscode-styled-components
Ctrl+P
/ Cmd+P
> Run: ext install vscode-styled-components
Values from src/theme.js
are automatically passed as a prop object to styled components
// Example of theme.js usage
import styled from "styled-components"
const Container = styled.div`
background: ${(props) => props.theme.colors.background};
@media (max-width: ${(props) => props.theme.breakpoints.s}) {
font-size: #{(props) => props.theme.fontSized.s};
}
`
Framer Motion - An open source and production-ready motion library for React on the web, used for our animated designs
Emojis: We use Twemoji, an open-source emoji set created by Twitter. These are hosted by us, and used to provide a consistent experience across operating systems.
// Example of emoji use
import Emoji from "./Emoji"
// Within JSX:
<Emoji text=":star:" size={1} /> // sized in `em`
src/components/Icon.js
is the component used to import icons to be usedsrc/components/Icon.js
:
// Example of how to add new icon not listed
import { ZzIconName } from "react-icons/zz"
// Then add to IconContect.Provider children:
{name === "alias" && <ZzIconName />}
From React component:
// Example of icon use
import Icon from "./Icon"
// Within JSX:
<Icon name="alias" />
import { graphql } from "gatsby"
export const query = graphql`
query {
hero: file(relativePath: { eq: "developers-eth-blocks.png" }) {
childImageSharp {
fluid(maxWidth: 800) {
...GatsbyImageSharpFluid
}
}
}
}
`
// These query results get passed as an object `props.data` to your component
import { graphql } from "gatsby"
export const repoInfo = graphql`
fragment repoInfo on GitHub_Repository {
stargazerCount
languages(orderBy: { field: SIZE, direction: DESC }, first: 2) {
nodes {
name
}
}
url
}
`
export const query = graphql`
query {
hardhatGitHub: github {
repository(owner: "nomiclabs", name: "hardhat") {
...repoInfo
}
}
}
`
// These query results get passed as an object `props.data` to your component
The Proof of Attendance Protocol is a dapp that distributes badges in the form of ERC-721 tokens to prove you participated in an event. More on POAPs.
If you have commited any changes in 2021 so far that were merged into our repo, you have a POAP waiting!
This includes our dedicated translators on Crowdin
A member of our team will verify the request and DM you with a personalized link to claim your own freshly minted POAP collectible!
To help with verification we request GitHub contributors connect their GitHub account with their Discord account (Discord > Settings > Connections > GitHub). Crowdin contributors will be verified directly through Crowdin by our team.
If you haven't contributed yet and would like to earn a POAP to show your loyalty to the Ethereum space, head over to the issues tab to get started!
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
We have a space to discuss all things ethereum.org – share your ideas or just say hi over on Discord.