-
-
Notifications
You must be signed in to change notification settings - Fork 127
Create "newbie track" documentation #1077
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
Open
anantone
wants to merge
11
commits into
bridgetownrb:main
Choose a base branch
from
anantone:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
de363d9
Create first-steps-for-newbies.md documentation
anantone e34b530
Document initial files scaffold for Bridgetown
anantone 7140e34
Enhance documentation for custom collections setup
anantone b88cc3e
Update links in first-steps-for-newbies.md
anantone d236481
Improve custom metadata section
anantone 0b05a5b
Enhance first steps guide with metadata details
anantone 872f6ca
Update instructions for custom collections
anantone a80f6ed
Add SEO and Feed tips as possible next steps
anantone 95e8b82
Clarify initial files explanation for beginners
anantone 1b212f5
Change code examples from Ruby to ERB format
anantone 9906f68
Delete 'Initial Files' document
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| order: 45 | ||
| title: First Steps for Newbies | ||
| top_section: Setup | ||
| description: If Bridgetown is your first web framework | ||
| category: first-steps | ||
| --- | ||
|
|
||
| You have just installed Bridgetown by following the [Getting Started](https://www.bridgetownrb.com/docs) guide. Great! Now what? | ||
|
|
||
| If you are not familiar with other web frameworks, your brand new site may seem confusing. Head to our [explanation](/docs/initial_files) to discover what all these files and folders are about! | ||
|
|
||
| ## First posts and pages | ||
|
|
||
| If you want a "typical", simple blog, open the `src` folder and identify: | ||
| - the `_posts` folder, which will result in the `posts` collection when you add files in the format `YYY-MM-DD-title.md`. These will follow the layout `post.erb` contained in the `_layouts` folder. | ||
| - the `index.md`, `about.md` and `posts.md` pages, which will follow the layout `page.erb` contained in the `_layouts` folder. | ||
|
|
||
| For now, `index.md` and `about.md` are static pages, respectively a home page and an about page. You can edit their content to suit your blog. | ||
|
|
||
| `posts.md` contains an example of how to access the items in a collection. | ||
|
|
||
| ```erb | ||
| <ul> | ||
| <% collections.posts.each do |post| %> | ||
| <li> | ||
| <a href="<%= post.relative_url %>"><%= post.data.title %></a> | ||
| </li> | ||
| <% end %> | ||
| </ul> | ||
| ``` | ||
|
|
||
| In this case, it will list the titles of all your posts, with links to the corresponding posts. You can also access other properties of your posts. For instance, `post.data.date` will give you the date. | ||
|
|
||
| This metadata is as versatile as you need it to be! You can create custom metadata in the [front matter](https://www.bridgetownrb.com/docs/front-matter) and access it in the same way with `post.data.order` or `post.data.category`. | ||
|
|
||
| ```yaml | ||
| --- | ||
| order: 45 | ||
| title: First Steps for Newbies | ||
| top_section: Setup | ||
| description: If Bridgetown is your first web framework | ||
| category: first-steps | ||
| --- | ||
| ``` | ||
|
|
||
| > [!NOTE]: | ||
| > If you create custom metadata for one post, you will need to include the same data for all other posts. If not all posts need this specific data, it is best to add it in a `_defaults.yml` file in your `_posts` directory, and leave it empty there. | ||
|
|
||
| ## A custom collection | ||
|
|
||
| If you want to create a custom collection (let's say "Docs" for your documentation), you will need to initialize it in the `config/initializers.rb` file. (See [detailed instructions here](https://www.bridgetownrb.com/docs/collections#custom-collections).) | ||
|
|
||
| ```ruby | ||
| Bridgetown.configure do |config| | ||
| collections do | ||
| docs do | ||
| output true | ||
| end | ||
| end | ||
| end | ||
| ``` | ||
|
|
||
| Then, create a `_docs` folder under the `src` folder, and add your documentation files in it. You can use an existing layout, or create a [custom layout](https://www.bridgetownrb.com/docs/layouts) in the `layouts` folder. | ||
|
|
||
| Add a `docs.md` file under the `src` folder to create a collection page similar to the `posts.md` page. You can create a list of docs, filtered by metadata, by accessing `collections.docs.each do |doc|`, just like for the posts above. | ||
|
|
||
| Edit the `components/shared/navbar.erb` file to add your new collection to the navigation bar (you can follow the format used for pages and posts). | ||
|
|
||
| ```erb | ||
| <nav> | ||
| <ul> | ||
| <li><a href="<%= relative_url '/' %>">Home</a></li> | ||
| <li><a href="<%= relative_url '/about' %>">About</a></li> | ||
| <li><a href="<%= relative_url '/posts' %>">Posts</a></li> | ||
| <li><a href="<%= relative_url '/docs' %>">Docs</a></li> | ||
| </ul> | ||
| </nav> | ||
| ``` | ||
|
|
||
| Now, you can add your content, either as a page, a post, or an item in a custom collection. But how will it look? | ||
|
|
||
| ## Looking good | ||
|
|
||
| Bridgetown comes with a decent default theme. You can edit the CSS directly in `frontend/styles/index.css`. | ||
|
|
||
| You can also search the web for CSS themes, and either place the contents of the theme's CSS file in index.css, or follow the theme's installation instructions (for instance [pico](https://picocss.com/docs#install-manually)) | ||
|
|
||
| ## What next? | ||
|
|
||
| You now have a basic Bridgetown site set up, and you can focus on what matters most: your content. | ||
|
|
||
| To make your site more accessible on the Web, consider adding the [SEO](/docs/bundled-configurations#seo) and [Feed](https://www.bridgetownrb.com/docs/bundled-configurations#feed) bundled configurations (instructions in the links). | ||
|
|
||
| When you're ready to publish your site, head over to our [deployment guide](/docs/deployment). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like how you put this!