#How to handle multiple content?

12 messages · Page 1 of 1 (latest)

random vector
#

I have a blog with posts in English and the files are ( .md ) I used the slug method to map over the posts and display them on the blog page.

Now I want to add other posts with a different language on another page let's call it (Blog-2) but I'm stuck on how to achieve that
do I need to create a new folder called posts-2 and add the (.md) files in then create a new slug what should I call it and can I have multiple slugs?

Sorry for that but I have another question related to the same idea

I have projects and every project is a (.astro) page, Now I want to render them all on the main projects page, how can I achieve that do I need to gather them in a folder called projects and then map over them, or how?

Thanks

vital oarBOT
#
Quiet in here?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

twin sigil
random vector
#

it's only the blog posts, I have 2 blog pages one with posts in English and the other in a different language, but the whole website is in english.

twin sigil
#

I think the best is to show an overview of the files tree and the pages tree you want to achieve, best is if you post an github minimal example, otherwise it is not easy to get the point just from the text description.
Technically speaking you can do whatever you want, you get all posts, then filter with metadata (front matter) and show the page you need.

random vector
#

├── components
│   ├── 404.astro
│   ├── About_Section.astro
│   ├── Featured_Post.astro
│   ├── Featured_Project.astro
│   ├── Footer.astro
│   ├── Form.astro
│   ├── Hero.astro
│   ├── Line_Break.astro
│   ├── Main.astro
│   ├── Navbar.astro
│   ├── Post.astro
│   ├── Tech_Stack.astro
│   └── Under_Construction.astro
├── env.d.ts

├── layouts
│   ├── BlogPostsLayout.astro
│   ├── FeaturedPostsLayout.astro
│   ├── FeaturedProjectsLayout.astro
│   ├── MainLayout.astro
│   ├── PostLayout.astro
│   ├── ProjectLayout.astro
│   └── StoryLayout.astro
├── pages
│   ├── 404.astro
│   ├── about.astro
│   ├── arabic.astro
│   ├── blog.astro
│   ├── contact.astro
│   ├── index.astro
│   ├── projects.astro
│   ├── [slug].astro
│   └── uses.astro
├── posts
│   ├── post-2.md
│   ├── post-3.md
│   └── post.md

This is the tree a simple portfolio website

#

This is a visual description for i want to achieve

#

I watched a tutorial on how to create a blog with astro

he simply did that

1- create a folder named posts in the /src
2- added the .md files (Markdown files) in the posts folder
3- He created a file called [slug].astro

For now this working

What I want to do is I want to have another blog page ( blog2.astro)

my problem is where to put the .md files for the second blog
the posts folder is already filled with. md files for the original blog page
and the slug file is related to this folder too

so how can I create a new blog page?

twin sigil
#

Just in another path

  • src/pages/blog1/[slug].astro
  • src/pages/blog2/[slug].astro
    Now either you have blog1/[slug].astro use filter1 and blog2/[slug].astro use filter2.
    Or have separate posts in posts1/*.md and posts2/*.md
random vector