Nue - Project Structure (2024)

Nue projects consist of one or more applications. Each directory in the root of your project folder is a separate application with its own configuration, layout, styling and scripting.

Nue - Project Structure (1)

Nue does not force you to adopt any fixed directory structure: There are no system folders and you can freely name your root-level application folders.

Applications

Nue is designed for building two kinds of applications:

  1. Multi-page applications. These are content-focused applications consisting of Markdown files. Good examples are documentation, blogging area or a feature tour. These apps are rendered server-side so that they can be easily consumed by search engines. The use of client-side JavaScript is optional.

  2. Single-page applications consist of an index.html file that serves all the HTML requests within the app. Good examples are admin dashboards, onboarding flows, surveys or login pages. The application is rendered on the client side with reactive components. These apps are usually hidden from search engines.

Nue - Project Structure (2)

Pages

Pages are the building blocks of multi-page applications. These pages are written with an extended Markdown syntax, which is designed for non-technical people like marketers and copywriters.

Page data

Each page is backed with different kinds of data:

  1. Metadata like title, description, theme color, favicon and hero image. This data is made accessible for search engines and content collections.

  2. Settings to fine-tune rendering details like whether CSS should be inlined on the page or what styles can be excluded from the page.

  3. Dependencies — information about scripts, styles, components and other assets that the page functionality depends on.

  4. Components for rendering headers, footers, sidebars and other components inside or outside the page.

Data propagation

The data is defined in three levels:

  1. The global, site-wide data is defined in site.yaml at the root directory.

  2. Application data is defined in *.yaml files inside the application directory. Each application sub-directory can also have its own data files.

  3. Page-specific data is defined in the frontmatter section of the Markdown page.

The data gets extended as you move from the site level to the page level.

Nue - Project Structure (3)

Data example

Let's say you have a page called blog/hello-world.md and the following global data in the site.yaml file:

title: Emma Bennetdescription: A designer and UX engineerorigin: https://emmabennet.cofavicon: /img/favicon.pngog_image: /img/og_emma.png

Then you have blog-specific metadata in blog/blog.yaml extending/overriding the global data:

title: Emma Bennet / Blogauthor: Emma Bennetog_image: /img/og_blog.png

Finally, the page-specific data is set on the front of the "hello-world.md" file:

---title: Hello, Worlddate: 2023-12-05---

With the above configuration in place, the document's <head> section is rendered as follows:

<head> <!-- Nue default values --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <!-- globals from site.yaml --> <link rel="shortcut icon" src="/img/favicon.jpg"> <meta name="description" content="A designer and UX engineer"> <!-- directory specific values from app.yaml --> <meta name="author" content="Emma Bennet"> <meta property="og:image" content="https://emmabennet.co/img/og_blog.png"> <!-- document specific values from the .md file --> <title>Hello, World</title> <meta property="article:published_time" content="2023-12-05"></head>

Why YAML?

Nue uses YAML as the main configuration language. As a content-focused format, it is by far the easiest one to grasp by non-technical people. It is the default choice in most Markdown-powered website generators.

Page dependencies

All your pages have different kinds of dependencies to enhance their look and feel:

ExtensionType
.jsJavaScript files for motion and reactivity
.tsTypeScript files for motion and reactivity
.cssCSS files for styling
.htmlCustom layouts and server-side components
.htmReactive components
.nueReactive components

The scripts, styles and components are automatically included in the page dependency tree similar to how data is propagated. The assets on the application root are included in all pages in the app and sub-directory assets are included on the pages in that sub-directory. For example:

Nue - Project Structure (4)

Global directories

You can define directories that are global in site.yaml. For example:

globals: [ "@globals", "scripts", "styles" ]

If a global directory resides on the root level, then all assets inside that directory are automatically included on every page, regardless of which app they belong to or how deeply they are nested in the file system.

When a global directory resides inside an application directory, then all assets in the directory are included on all pages of the app. Here, for example, we have defined @globals and css as global dirs:

Nue - Project Structure (5)

Libraries

Library folders contain assets that can be explicitly included on a page with an include statement. You can define certain folders to be libraries in the site.yaml file. For example:

libs: ["@lib", lib]

These libraries can reside both on the root level, and inside a specific application. Once the libraries have been defined, you include library assets in site.yaml, application data (like docs/app.yaml), or in the page's frontmatter with an include statement as follows:

include: [syntax-highlight, video]

If you include assets in several levels, the values of include statements are concatenated into one single array. The matches are partial so that a value such as "syntax" will match both "syntax-highlight" and "syntax-extras".

Excluding assets

You can exclude assets from the pages with an exclude property, which works the same way as the include statement:

exclude: [syntax-highlight, video]

This allows you to strip unneeded assets from the request and reduce the payload.

Example

Here's a more complex example that gives you an idea how dependencies are calculated:

Nue - Project Structure (6)

Frontpage

All scripts, styles, and components in the root level are dependencies for the front page and all other root level pages, so they are not propagated upwards to the application directories.

You may want to clean up the root directory from front page assets by placing them into a folder named "home", for example, and declaring it in the frontmatter area of the front page:

appdir: home

With the above setting all assets inside the "home" directory become dependencies of your root level index.md.

Static files

Static files like .png, .jpg, .txt, .csv, or .json are copied directly from the source directory to the distribution directory without processing. They work outside the page dependency management system.

404 file

A file named 404.md in the root level, acts as a target for non-existent files. You can use the include statement to customize its styling and behaviour.

Nue - Project Structure (2024)
Top Articles
Barbells - Weight Training Barbells
How much does a Standard and Olympic Barbell weigh? – FitnessPurity
Pet For Sale Craigslist
It may surround a charged particle Crossword Clue
1970 Chevrolet Chevelle SS - Skyway Classics
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
South Carolina defeats Caitlin Clark and Iowa to win national championship and complete perfect season
Craigslist Vermillion South Dakota
4Chan Louisville
Günstige Angebote online shoppen - QVC.de
Bros Movie Wiki
David Turner Evangelist Net Worth
R/Afkarena
Becu Turbotax Discount Code
Straight Talk Phones With 7 Inch Screen
Hobby Stores Near Me Now
The Ultimate Guide to Extras Casting: Everything You Need to Know - MyCastingFile
67-72 Chevy Truck Parts Craigslist
Routing Number For Radiant Credit Union
Xfinity Outage Map Fredericksburg Va
Form F-1 - Registration statement for certain foreign private issuers
Gina Wilson Angle Addition Postulate
Avatar: The Way Of Water Showtimes Near Maya Pittsburg Cinemas
European Wax Center Toms River Reviews
1979 Ford F350 For Sale Craigslist
13301 South Orange Blossom Trail
Craigslist Northern Minnesota
Craigslist Comes Clean: No More 'Adult Services,' Ever
031515 828
Stouffville Tribune (Stouffville, ON), March 27, 1947, p. 1
How to Draw a Bubble Letter M in 5 Easy Steps
Culver's Hartland Flavor Of The Day
LEGO Star Wars: Rebuild the Galaxy Review - Latest Animated Special Brings Loads of Fun With An Emotional Twist
Mississippi State baseball vs Virginia score, highlights: Bulldogs crumble in the ninth, season ends in NCAA regional
To Give A Guarantee Promise Figgerits
Edict Of Force Poe
How To Get Soul Reaper Knife In Critical Legends
Claim loopt uit op pr-drama voor Hohenzollern
Best Restaurant In Glendale Az
159R Bus Schedule Pdf
craigslist: modesto jobs, apartments, for sale, services, community, and events
Improving curriculum alignment and achieving learning goals by making the curriculum visible | Semantic Scholar
Firestone Batteries Prices
Costco Gas Foster City
Nimbleaf Evolution
Ssc South Carolina
Large Pawn Shops Near Me
Zipformsonline Plus Login
Bedbathandbeyond Flemington Nj
Shannon Sharpe Pointing Gif
Bradshaw And Range Obituaries
2121 Gateway Point
Latest Posts
Article information

Author: Edwin Metz

Last Updated:

Views: 6178

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.