Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added medium blogs fetch feature for blogs section #445

Merged
merged 13 commits into from
Nov 15, 2021

Conversation

CanciuCostin
Copy link
Contributor

@CanciuCostin CanciuCostin commented Nov 8, 2021

I've added this for my personal blog and I think it would be a nice feature.
See output for my medium account (costin.canciu - https://medium.com/@costin.canciu):
image

The hardcoded blogs will still be displayed if the medium user account is not set in portofolio.js.

@vercel
Copy link

vercel bot commented Nov 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/saadpasta/developer-folio/6PUQCoxizfYWep9fzYc2kpHR26Cc
✅ Preview: https://developer-folio-git-fork-canciucostin-master-saadpasta.vercel.app

useEffect(() => {
if (blogSection.mediumUserAccount !== "")
fetch(
"https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/@" +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than relying on a 3rd party service at runtime, I would like to get the data via fetch.js and save it in say /posts.json and load that file at run time. That's how it's done for the project section(see #333).

@naveen521kk
Copy link
Collaborator

Is there any reason why you closed this?

@CanciuCostin
Copy link
Contributor Author

CanciuCostin commented Nov 8, 2021

Re-opening the issue (it was closed after branch rebase, sorry for that)

Fetching the blogs on start makes sense.
I've replaced my first 2 commits with new ones.

Environment variables to be set for tests:
USE_MEDIUM_DATA = "true"
MEDIUM_USERNAME = "costin.canciu"

@naveen521kk
Copy link
Collaborator

I will review this PR tomorrow. Thanks for the PR.

@naveen521kk naveen521kk self-requested a review November 11, 2021 15:11
env.example Outdated Show resolved Hide resolved
fetch.js Outdated Show resolved Hide resolved
src/containers/blogs/Blogs.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@naveen521kk naveen521kk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@naveen521kk naveen521kk merged commit 5777a43 into saadpasta:master Nov 15, 2021
@naveen521kk
Copy link
Collaborator

Thanks for your contribution :)

/>
);
})
: mediumBlogs.map((blog, i) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this doesn't work and broke the main site. from console:

TypeError: x.map is not a function
    H Blogs.js:79
    React 7
    unstable_runWithPriority scheduler.production.min.js:19
    React 5
    y Blogs.js:11
    H Blogs.js:39
    promise callback*H/< Blogs.js:35
    React 2
    unstable_runWithPriority scheduler.production.min.js:19
    React 4
    unstable_runWithPriority scheduler.production.min.js:19
    React 6
    <anonymous> index.js:7
    i (index):1
    <anonymous> main.99d3a735.chunk.js:1
    i (index):1
    r (index):1
    t (index):1
    <anonymous> main.99d3a735.chunk.js:1
react-dom.production.min.js:209:194

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayMediumBlogs needs to be set to false in portofolio.js, I've just commited this after merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#446 - Created additional pull request

@naveen521kk
Copy link
Collaborator

@allcontributors add @CanciuCostin for code

@allcontributors
Copy link
Contributor

@naveen521kk

I've put up a pull request to add @CanciuCostin! 🎉

Mehranmzn pushed a commit to Mehranmzn/mehranmzn.github.io that referenced this pull request Sep 13, 2024
* added medium blogs fetch

* added medium args to env.example

* added displayMediumBlogs to blogSection

* added blogs.json parsing

* renamed function and added comment for extractTextContent

* removed USE_MEDIUM_DATA env variable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated readme with medium blogs fetch docs

* Update portfolio.js

* set displayMediumBlogs default to true in portofolio.js

* removed USE_MEDIUM_DATA env variable from fetch.js

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants