Giter VIP home page Giter VIP logo

revista-gatsby-blog-magazine's Introduction

Contributors Forks Stargazers Issues AGPL License LinkedIn


Logo

Revista

Open-source Gatsby Magazine/Blog template
Report Bug · Request Feature


About The Project

Revista Screen Shot

Revista is an MIT licensed open-source magazine/blog template, built using React and Gatsby.

At the moment, Revista is a very opinionated template. We originally made specific changes to suit our interests and needs, and now that we are open-sourcing our template, some of these opinionated choices remain.

We've listed customization instruction in How to Customize. Apart from changing basic metadata, further customization will require knowledge of React, Gatsby, and GraphQL. However, if you are happy with Revista as-is, it is (mostly) set up to begin publishing articles right away!

(back to top)

Built With

  • React
  • Gatsby
  • Markdown

(back to top)

Revista? Here is our tl:dr

  1. Open-source blog or magazine template built with Gatsby, React, and Markdown
  2. Many out-of-the-box configurations have already been completed, so all you have to do is make a few small adjustments (keep reading) and write articles.
  3. Clean, modern, complete design (i.e. more than a boilerplate), and very easy to customize.
  4. Incredibly fast speeds, optimized SEO, and since we are open-source, many more improvements on the way.

Quick Start

To get a local copy up and running:

  1. Fork our project
  2. Clone to your local machine

Then,

yarn
yarn start

OR

npm i
npm run start
# You might get an error as we use yarn. If you do:
# 1. Delete yarn.lock
# 2. Delete node_modules if it exists, otherwise ignore
# 3. Open package.json and modify scripts to use npm instead of yarn
# 4. Run above commands again

Wait, there's more..

  1. (optional) Look at structure and articles in /content to understand what metadata to include in your articles.
  2. Delete ALL content in /content except the /content/template folder
  3. Place your articles in /content with the required metadata (see any existing .md file in /content for an example)

Guide to Article Metadata

See any existing .md file in /content for an example of metadata.

title: Article title. Mandatory.

image: Path to image. Optional, but excluding may result in display errors.

imageAttribution: Sites like Vecteezy require attribution, so consider using this field if getting images from a source that requires attribution. Optional, can be excluded without error.

date: Mandatory. More recent dates are ordered first.

category: Mandatory.

trending: Optional. Displays article in "Featured" section. See demo site for how this is displayed.

topPick: Optional. Displays article in "Featured" section. See demo site for how this is displayed.

popular: Optional. Displays article in "Featured" section. See demo site for how this is displayed.

How to Customize

In order to turn Revista into your own blog or magazine, you'll have to make some changes. Let's discuss them here.

1. Modify gatsby-config.js to contain your information, not ours

Simply run through gatsby-config.js and change settings as needed. In addition to updating metadata to your info, uncomment gatsby-plugin-robots-txt and update the paths to your own site.

Note: if using the Netlify sitemap plugin, your sitemap will be located at https://yoursiteurl.com/sitemap.xml

2. Enable Netlify Forms (optional)

If you'd like to use Netlify Forms, head over to src/components/ContactForm.jsx and uncomment the line that says // data-netlify="true" (around line 57). Everything else is setup, so you will start receiving form submissions through Netlify. Ensure you set up email notifications in the Netlify app, if you want that.

3. Replace icon and favicon with your own

Note that if your icon is not close to 1:1 size, you may see display errors. Keep an eye out for this.

4. Replace all placeholder text with your own.

All pages are in /src/pages.

Article template and category page template are in /src/templates.

Most page components are in /src/components, and almost everything else is located in one of the other /src subfolders.

Pages/Components with text that you will need to update:

  • src/components/Hero.jsx
  • src/components/Sidebar/ - several components to update
  • src/pages/about.jsx - several components to update
  • src/pages/contact.jsx - several components to update
  • src/pages/support-us.jsx - several components to update
  • src/pages/privacy-policy.jsx - add your own
  • src/pages/terms-and-conditions.jsx - add your own
  • src/components/Footer.jsx - add the name of your site
  • src/constants/socialLinks.js - add your own social links and icons

Note: All main pages are linked to from the Navbar, so we recommend going page-by-page to look for text that needs updating. All components with text that needs updating will either be in src/pages/ or src/components/

5. Customize Hero category list

The categories in the Hero section are NOT autogenerated - /src/components/utils/heroCategories.jsx

We decided it was easier this way, since you can decide on specific colors for certain categories, and choose your Main categories.

However, the Categories page is autogenerated, and the categories list in the sidebar is autogenerated as well. If you'd like your Hero to autogenerate categories, simply copy one of those GraphQL queries and adjust accordingly.

Form Submission

Note: We've decided to change to Netlify Forms for simplicity.

If you are using Netlify, this will already be set up for you. Ensure to read their docs to understand how Netlify Forms work.

Leaving this here in case we decide to change back to StaticForms.


StaticForms and Gatsby Environment Variables. With the current code as-is, you may get an error when building.

You will have to

  1. Set up your contact form, if you plan to use it.
  2. Get an API key from StaticForms.
  3. Create the following:
# .env
STATIC_FORMS_KEY=YOUR_KEY

If using Netlify, add your API key to the Netlify app as well.

(back to top)

Roadmap

  • Convert opened.one to Revista template
  • Launch Revista, free forever
  • Improve Documentation
  • Clean up messy code
  • Drink more coffee
  • Multi-language Support
  • What else would you like to see? Open an issue!

See the open issues for a full list of proposed features (and known issues).

(back to top)

FAQs

1. How do I change the Hero categories?

Navigate to - /src/components/utils/heroCategories.jsx

Currently, the Hero categories are hard-coded. We decided it was easier this way, since you can decide on specific colors for certain categories, and choose your Main categories.

However, the Categories page is autogenerated, and the categories list in the sidebar is autogenerated as well. If you'd like your Hero to autogenerate categories, simply copy one of those GraphQL queries and adjust accordingly.

2. Do the names of the folders in /content mean anything?

They mean nothing to the generated site. They are only for personal organization. GraphQL only retrieves .md or .mdx files, and does not store the folder structure.

3. How do I change the GraphQL queries?

Most queries are located alongside the elements they belong to. I.e. post-template.jsx contains the GraphQL query to get post data.

Once your site is running locally, navigate to http://localhost:8000/\_\_\_graphql to test and build queries. This will be printed in your console well for easy nativation.

You may prefer to store them all in a separate file, but we like to keep everything organized together.

4. Why are there so many warnings when I run Revista locally?

Most of these warnings are easy to remove - they are <a> tags with a placeholder href, or they are unused imports or GraphQL queries. Everything will still compile and run perfectly fine, and I decided to leave those warnings there since you may have a use for them. I.e. the unused GraphQL imports.

You can address these warnings without any issues.

One warning has to do with CSS modules. This is on the list of to-do's, and will also not affect compilation or local development.

Usage

Revista is a Markdown + Gatsby blog/magazine starter, and can be hosted for free on sites like Netlify. I'm proud of my design, and i'd love to see other sites using it.

You're welcome to fork Revista and use it for your own site. You are not required to publish your code, you are only required to give credit (per MIT license).

(back to top)

License

AGPL License

Distributed under the MIT License. See our license file for more information.

Usage Agreement

By forking our repository and using it for your own purposes, we require two things.

1. You MUST adhere to our MIT license

What does this mean? MIT is a very permissive license, and you are free to fork, modify, and redistribute as you please. We simply require you to give credit to either 1) Chris, Revista's creator, by linking to Revista's Github repo, or 2) Mesmer Design, Chris' web development company.

2. You must delete all content in the /content folder

We've left some old files there so that you can see how to structure the .md article file metadata. After you understand it, we recommend keeping the template (and adjusting to your needs), and removing all other files. You probably don't want placeholder files on your live site :)

(back to top)

Contact

Chris (primary maintainer) - [email protected]

Project Link: https://github.com/chrisnmorrison/revista-gatsby-blog-magazine

(back to top)

Acknowledgments

(back to top)

revista-gatsby-blog-magazine's People

Contributors

chrisnmorrison avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

revista-gatsby-blog-magazine's Issues

Render tables from Markdown

Markdown tables are not being converted into HTML.

You can in fact see the plain text for such tables.

image

Do I have to install anything, or is it just not supported?

Possible memory leak

Hi.
I'm porting my blog to this theme.

There are around 130 articles, each with one cover image (well, actually there are some more, but I temporarily deleted them to try to fix this issue).

When compiling it, I used to see an error about heap allocation.

To solve it locally I had to increase the memory limit of the build process, updating the build command in the package.json file:

    "build": "cross-env NODE_OPTIONS=--max-old-space-size=16384 gatsby build --prefix-paths",
    "develop": "cross-env NODE_OPTIONS=--max-old-space-size=16384 gatsby develop",

Even with 16GB of memory, the build fails, as you can see from the logs here:
https://app.netlify.com/sites/thriving-lolly-25f944/deploys/641ad5eedb761b02e5be526e

Any idea on what can cause the memory leak?

Accept png as cover image

Hello.

the theme works well if I use JPG files for cover images.

If I use png, it does not even compile.

Is it a matter of configurations?

Read article URL from FrontMatter instead of automatically generating it

I'm migrating my blog to this theme.

I have my articles structured as

  • posts
    • {type}
      • {year}
        • {article number}-{article-name}.md

and each article specifies the final URL in a field in the FrontMatter section.

The article with FM like this:

title: "5 tricks every C# dev should know about LINQPad"
path: "/blog/5-linqpad-tricks"

Generates this page :
https://www.code4it.dev/blog/5-linqpad-tricks
Notice that the path does not reflect the folder structure

Now, after the migration, the page URLs must not change. Is there a way to generate page URLs reading from FrontMatter?

Add GDPR cookie banner

Since EU forces blogs to have a cookie banner, due to GDPR restrictions, I think it could be useful to add it to the template.

If I remember well, there's already an existing layout that you have to add to the page layout, so it should be easy to add (I suppose! )

Add tags to blog posts

Many blog posts are about different topics (let's say "Sushi", "Vegan", "Rice") so we should be able to tag them with different values (afaik, we can only have 1 category per article).

This includes filtering by tag: if the users clicks "Vegan", they should be able to see only blog articles about that topic (ordered by date)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.