Skip to content
Permalink
Browse files

Adds timeline page with Twitter widget script in layout + share/follo…

…w buttons
  • Loading branch information...
doppelganger9 committed Mar 9, 2019
1 parent bfbdee1 commit b7af093350cbc4a880584c1307626ab0aba863f0
Showing with 61 additions and 0 deletions.
  1. +21 −0 src/components/layout.js
  2. +36 −0 src/pages/timeline.js
  3. +4 −0 src/templates/blog-post.js
@@ -3,6 +3,7 @@ import { Link } from "gatsby"

import { rhythm, scale } from "../utils/typography"
import PrivacyPolicy from "./privacy-policy"
import Helmet from 'react-helmet'

class Layout extends React.Component {
render() {
@@ -25,6 +26,26 @@ class Layout extends React.Component {
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
}}
>
<Helmet>{/* Adding Twitter Widget wherever we use Layout */}
<script type="text/javascript">{`
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));`}
</script>
</Helmet>
<header>{header}</header>
<main>{children}</main>
<footer>
@@ -0,0 +1,36 @@
import React from "react"
import { graphql } from "gatsby"

import Layout from "../components/layout"
import SEO from "../components/seo"
import { FaTwitter } from 'react-icons/fa'

class TwitterTimelinePage extends React.Component {
render() {
const { data } = this.props
const siteTitle = data.site.siteMetadata.title

return (
<Layout location={this.props.location} title={siteTitle}>
<SEO title="Twitter Timeline" />
<h1><FaTwitter /> My Twitter timeline</h1>

<a className="twitter-follow-button" href="https://twitter.com/doppelganger9?ref_src=twsrc%5Etfw" data-show-count="false">Follow @doppelganger9</a>
<a className="twitter-timeline" href="https://twitter.com/doppelganger9?ref_src=twsrc%5Etfw">Tweets by doppelganger9</a>

</Layout>
)
}
}

export default TwitterTimelinePage

export const pageQuery = graphql`
query PageQuery {
site {
siteMetadata {
title
}
}
}
`;
@@ -36,6 +36,10 @@ class BlogPostTemplate extends React.Component {
marginBottom: rhythm(1),
}}
/>
<a className="twitter-share-button"
href={`https://twitter.com/intent/tweet?via=mercatante`}
data-size="large">Tweet</a>{` `}
<a className="twitter-follow-button" href="https://twitter.com/doppelganger9?ref_src=twsrc%5Etfw" data-show-count="false" data-size="large">Follow @doppelganger9</a>
<Bio />

<ul

0 comments on commit b7af093

Please sign in to comment.
You can’t perform that action at this time.