Page

Discover how to use page objects in BuckShotPlusPlus!

In BuckshotPlusPlus, pages represent the individual screens or web pages of your application. While they are similar to views, pages are specifically designed to define the structure and content of a complete web page.

How it works

Declaring pages

To declare a page in BuckshotPlusPlus, you use the page keyword followed by the name of the page and its properties enclosed in curly braces. The properties of a page define its title, body and other attributes.

Here's a basic example:

page index{
	title = "My Index!"
	body = My_Body_View
}

In this example, a page named index is declared with a title "My Index!" and a body content defined by the My_Body_View view.

Page URLs

The name of the page determines its URL. For instance, the index page corresponds to the root URL (/). If you name your page something other than index, the page's URL will be based on its name. For example:

page blog{
	title = "My cool blog!"
	body = My_Blog_Body_View
}

This will create a page accessible at the /blog URL.

Custom fonts

In BuckShotPlusPlus, you can easily import custom fonts using the fonts attribute and specify an array of url's like in the following example:

page index{
	title = "My Index!"
	body = My_Body_View
	fonts = ["https://fonts.googleapis.com/css2?family=Josefin+Sans&family=Nerko+One&family=Poppins&display=swap"]
}

Use cases

  1. Website Structure: Pages allow you to define the structure of your website, specifying which content appears on which page.

  2. Dynamic Content: By associating different views with different pages, you can create dynamic web pages that change based on user interactions or other conditions.

  3. SEO Optimization: By giving descriptive names and titles to your pages, you can improve the search engine optimization (SEO) of your website.

Important notes

  • Always use descriptive names for your pages to make your website more user-friendly and improve SEO.

  • Ensure that the views associated with a page are correctly defined and tested to avoid rendering issues.

  • Remember that the name of the page determines its URL, so choose names that are relevant to the content of the page.

Last updated

Was this helpful?