fix: remove medium links and rss feeds
This commit is contained in:
parent
1d4ae06541
commit
0ffca02ec1
@ -2,7 +2,6 @@ import _ from 'lodash';
|
|||||||
import compareDesc from 'date-fns/compare_desc';
|
import compareDesc from 'date-fns/compare_desc';
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
|
|
||||||
import { getMediumFeed } from './medium';
|
|
||||||
import { getLybsynFeed } from './lybsyn';
|
import { getLybsynFeed } from './lybsyn';
|
||||||
|
|
||||||
const log = debug('fcc:rss:news-feed');
|
const log = debug('fcc:rss:news-feed');
|
||||||
@ -13,7 +12,6 @@ class NewsFeed {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.state = {
|
this.state = {
|
||||||
readyState: false,
|
readyState: false,
|
||||||
mediumFeed: [],
|
|
||||||
lybsynFeed: [],
|
lybsynFeed: [],
|
||||||
combinedFeed: []
|
combinedFeed: []
|
||||||
};
|
};
|
||||||
@ -31,18 +29,17 @@ class NewsFeed {
|
|||||||
refreshFeeds = () => {
|
refreshFeeds = () => {
|
||||||
const currentFeed = this.state.combinedFeed.slice(0);
|
const currentFeed = this.state.combinedFeed.slice(0);
|
||||||
log('grabbing feeds');
|
log('grabbing feeds');
|
||||||
return Promise.all([getMediumFeed(), getLybsynFeed()])
|
return Promise.all([getLybsynFeed()])
|
||||||
.then(([mediumFeed, lybsynFeed]) =>
|
.then(([lybsynFeed]) =>
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state,
|
...state,
|
||||||
mediumFeed,
|
|
||||||
lybsynFeed
|
lybsynFeed
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
log('crossing the streams');
|
log('crossing the streams');
|
||||||
const { mediumFeed, lybsynFeed } = this.state;
|
const { lybsynFeed } = this.state;
|
||||||
const combinedFeed = [...mediumFeed, ...lybsynFeed].sort((a, b) => {
|
const combinedFeed = [...lybsynFeed].sort((a, b) => {
|
||||||
return compareDesc(a.isoDate, b.isoDate);
|
return compareDesc(a.isoDate, b.isoDate);
|
||||||
});
|
});
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import Parser from 'rss-parser';
|
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
const parser = new Parser();
|
|
||||||
|
|
||||||
const mediumFeed = 'https://medium.freecodecamp.org/feed';
|
|
||||||
|
|
||||||
function getExtract(str) {
|
|
||||||
return str.slice(0, str.indexOf('</p>') + 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addResponsiveClass(str) {
|
|
||||||
return str.replace(/<img/g, '<img class="img-responsive"');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getMediumFeed() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
parser.parseURL(mediumFeed, (err, feed) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
const items = feed.items
|
|
||||||
.map(item =>
|
|
||||||
_.pick(item, ['title', 'link', 'isoDate', 'content:encoded'])
|
|
||||||
)
|
|
||||||
.map(item => ({
|
|
||||||
...item,
|
|
||||||
extract: getExtract(item['content:encoded'])
|
|
||||||
}))
|
|
||||||
.map(item => _.omit(item, ['content:encoded']))
|
|
||||||
.map(item => ({ ...item, extract: addResponsiveClass(item.extract) }));
|
|
||||||
resolve(items);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
@ -80,7 +80,6 @@ function Footer() {
|
|||||||
<Link to='https://www.youtube.com/freecodecamp'>Youtube</Link>
|
<Link to='https://www.youtube.com/freecodecamp'>Youtube</Link>
|
||||||
<Link to='https://podcast.freecodecamp.org'>Podcast</Link>
|
<Link to='https://podcast.freecodecamp.org'>Podcast</Link>
|
||||||
<Link to='https://twitter.com/freecodecamp'>Twitter</Link>
|
<Link to='https://twitter.com/freecodecamp'>Twitter</Link>
|
||||||
<Link to='https://medium.freecodecamp.org'>Medium</Link>
|
|
||||||
<Link to='https://instagram.com/freecodecamp'>Instagram</Link>
|
<Link to='https://instagram.com/freecodecamp'>Instagram</Link>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -52,11 +52,7 @@ const AboutPage = () => {
|
|||||||
<h4>How big is the freeCodeCamp community?</h4>
|
<h4>How big is the freeCodeCamp community?</h4>
|
||||||
<p>
|
<p>
|
||||||
If you add up all the people who use our learning platform, read
|
If you add up all the people who use our learning platform, read
|
||||||
our{' '}
|
our <Link to='/news'>news articles</Link>, watch our{' '}
|
||||||
<Link to='https://medium.freecodecamp.org'>
|
|
||||||
Medium publication
|
|
||||||
</Link>
|
|
||||||
, watch our{' '}
|
|
||||||
<Link to='https://youtube.com/freecodecamp'>YouTube channel</Link>
|
<Link to='https://youtube.com/freecodecamp'>YouTube channel</Link>
|
||||||
, and post on{' '}
|
, and post on{' '}
|
||||||
<Link external={true} to='/forum'>
|
<Link external={true} to='/forum'>
|
||||||
|
@ -42,7 +42,7 @@ exports[`createRedirects matches the snapshot 1`] = `
|
|||||||
/forum/* https://forum.example.com/:splat 200
|
/forum/* https://forum.example.com/:splat 200
|
||||||
/privacy https://forum.example.com/t/free-code-camp-privacy-policy/19545 301
|
/privacy https://forum.example.com/t/free-code-camp-privacy-policy/19545 301
|
||||||
/nonprofit-project-instructions https://forum.example.com/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
/nonprofit-project-instructions https://forum.example.com/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
||||||
/how-nonprofit-projects-work https://medium.freecodecamp.org/open-source-for-good-1a0ea9f32d5a 301
|
/how-nonprofit-projects-work https://www.freecodecamp.org/news/open-source-for-good-1a0ea9f32d5a 301
|
||||||
|
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
@ -63,7 +63,7 @@ const template = `#api redirect
|
|||||||
/forum/* #{{FORUM}}/:splat 200
|
/forum/* #{{FORUM}}/:splat 200
|
||||||
/privacy #{{FORUM}}/t/free-code-camp-privacy-policy/19545 301
|
/privacy #{{FORUM}}/t/free-code-camp-privacy-policy/19545 301
|
||||||
/nonprofit-project-instructions #{{FORUM}}/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
/nonprofit-project-instructions #{{FORUM}}/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
||||||
/how-nonprofit-projects-work https://medium.freecodecamp.org/open-source-for-good-1a0ea9f32d5a 301
|
/how-nonprofit-projects-work https://www.freecodecamp.org/news/open-source-for-good-1a0ea9f32d5a 301
|
||||||
|
|
||||||
`;
|
`;
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user