Skip to content

Commit 2a76758

Browse files
committed
basic Blog setup
1 parent 47a9c08 commit 2a76758

File tree

6 files changed

+118
-37
lines changed

6 files changed

+118
-37
lines changed

.eslintrc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
},
1313
"settings": {
1414
"react": {
15-
"version": "detect"
16-
}
17-
},
18-
"extends": [
19-
// https://eslint.org/docs/rules/
20-
"eslint:recommended",
21-
// https://github.com/yannickcr/eslint-plugin-react#recommended
22-
"plugin:react/recommended",
23-
// https://github.com/benmosher/eslint-plugin-import
24-
"plugin:import/recommended"
25-
]
26-
}
15+
"version": "detect"
16+
}
17+
}
18+
// },
19+
// "extends": [
20+
// // https://eslint.org/docs/rules/
21+
// "eslint:recommended",
22+
// // https://github.com/yannickcr/eslint-plugin-react#recommended
23+
// "plugin:react/recommended",
24+
// // https://github.com/benmosher/eslint-plugin-import
25+
// "plugin:import/recommended"
26+
// ]
27+
}

hola.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
---
22
title: Hola
3-
date: '2020-05-25'
4-
updated: '2020-05-25'
5-
slug: hola
3+
date: "2020-05-25"
4+
updated: "2020-05-25"
65
description: Como añadir estilo a los bloques de código en nuestras páginas con Gatsby.
76
---
87

98
# QUE TAL
109

1110
Hloasdasd
1211

13-
1412
asdasd
15-
16-

src/css/style.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
/*! purgecss start ignore */
22
@tailwind base;
33
@tailwind components;
4+
5+
h1 {
6+
@apply text-5xl;
7+
}
8+
9+
h2 {
10+
@apply text-4xl;
11+
}
12+
13+
h3 {
14+
@apply text-3xl;
15+
}
16+
17+
h4 {
18+
@apply text-2xl;
19+
}
20+
21+
422
/*! purgecss end ignore */
5-
@tailwind utilities;
23+
@tailwind utilities;

src/pages/blog.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from "react";
2+
3+
import Layout from "../components/layout";
4+
import SEO from "../components/seo";
5+
6+
import { StaticQuery, graphql, Link } from "gatsby";
7+
import { render } from "react-dom";
8+
9+
function BlogPage(articulos) {
10+
return (
11+
<Layout>
12+
<SEO title="Blog de Javascript Ecuador" />
13+
<div>
14+
<h2>Lista de blogs:</h2>
15+
16+
<ul>
17+
{articulos.map((articulo) => (
18+
<li>
19+
<Link to={`/blog/${articulo.slug}`}>{articulo.title}</Link>
20+
</li>
21+
))}
22+
</ul>
23+
</div>
24+
</Layout>
25+
);
26+
}
27+
28+
function renderBlogPage() {
29+
return (
30+
<StaticQuery
31+
query={graphql`
32+
query BlogList {
33+
articulos: allMdx {
34+
edges {
35+
node {
36+
slug
37+
frontmatter {
38+
title
39+
description
40+
}
41+
}
42+
}
43+
}
44+
}
45+
`}
46+
render={(data) => {
47+
const articulosFormateados = data.articulos.edges.map((articulo) => {
48+
return {
49+
...articulo.node.frontmatter,
50+
slug: articulo.node.slug,
51+
};
52+
});
53+
return BlogPage(articulosFormateados);
54+
}}
55+
/>
56+
);
57+
}
58+
59+
export default renderBlogPage;

src/pages/blog/hola.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
---
22
title: Hola
3-
date: '2020-05-25'
4-
updated: '2020-05-25'
5-
slug: hola
3+
date: "2020-05-25"
4+
updated: "2020-05-25"
65
description: Como añadir estilo a los bloques de código en nuestras páginas con Gatsby.
76
---
87

9-
# QUE TAL
8+
## Header
109

11-
Hloasdasd
12-
13-
14-
asdasd
10+
### Subheader
1511

12+
#### SubSubHeader
1613

14+
Esta es una **entrada** del blog

src/templates/blog-entry.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
import React from 'react';
1+
import React from "react";
2+
import Layout from "../components/layout";
3+
import SEO from "../components/seo";
24

35
// import PropTypes from 'prop-types';
46

5-
// export default function BlogEntry({pageContext, children}){
6-
export default function BlogEntry(){
7-
return <div>
8-
<h1>Blog entry</h1>
9-
<hr />
10-
{/* <p>{pageContext.title}</p>
11-
{children} */}
12-
</div>
7+
export default function BlogEntry({ pageContext, children }) {
8+
return (
9+
<Layout>
10+
<SEO
11+
keywords={[`gatsby`, `tailwind`, `react`, `tailwindcss`]}
12+
title="About"
13+
/>
14+
15+
<section className="flex flex-col md:flex-row">
16+
<h1>{pageContext.frontmatter.title}</h1>
17+
<section>{children}</section>
18+
{/* <div className="md:w-2/3 md:mr-8"></div> */}
19+
</section>
20+
</Layout>
21+
);
1322
}
1423

1524
// BlogEntry.prototype = {
@@ -20,4 +29,4 @@ import React from 'react';
2029
// // description: PropTypes.string,
2130
// // })
2231
// pageContext: PropTypes.any
23-
// }
32+
// }

0 commit comments

Comments
 (0)