From 34412ee5267954ab57bd9bf09a9d528231c69d93 Mon Sep 17 00:00:00 2001 From: Chris Sells Date: Wed, 12 Jul 2023 15:59:52 -0700 Subject: [PATCH] custom finisher example, start of a set of examples --- example/finisher/.gitignore | 6 + example/finisher/analysis_options.yaml | 30 ++ example/finisher/bin/finisher.dart | 29 + example/finisher/build/index.html | 8 + example/finisher/build/posts/post1.html | 2 + example/finisher/build/posts/post2.html | 2 + example/finisher/pubspec.lock | 508 ++++++++++++++++++ example/finisher/pubspec.yaml | 15 + .../source/_includes/layouts/homepage.jinja | 14 + example/finisher/source/index.md | 15 + example/finisher/source/posts/post1.md | 7 + example/finisher/source/posts/post2.md | 7 + packages/static_shock_cli/pubspec.lock | 7 +- .../source/guides/add-a-page.md | 29 +- .../source/guides/compile-sass.md | 2 + .../source/guides/copy-assets.md | 2 + .../source/guides/create-rss-feed.md | 2 + .../guides/display-directory-of-pages.md | 2 + .../source/guides/examples.md | 23 + .../source/guides/use-remote-css-and-js.md | 2 + 20 files changed, 699 insertions(+), 13 deletions(-) create mode 100644 example/finisher/.gitignore create mode 100644 example/finisher/analysis_options.yaml create mode 100644 example/finisher/bin/finisher.dart create mode 100644 example/finisher/build/index.html create mode 100644 example/finisher/build/posts/post1.html create mode 100644 example/finisher/build/posts/post2.html create mode 100644 example/finisher/pubspec.lock create mode 100644 example/finisher/pubspec.yaml create mode 100644 example/finisher/source/_includes/layouts/homepage.jinja create mode 100644 example/finisher/source/index.md create mode 100644 example/finisher/source/posts/post1.md create mode 100644 example/finisher/source/posts/post2.md create mode 100644 packages/static_shock_docs/source/guides/examples.md diff --git a/example/finisher/.gitignore b/example/finisher/.gitignore new file mode 100644 index 0000000..ed586c4 --- /dev/null +++ b/example/finisher/.gitignore @@ -0,0 +1,6 @@ +# Build output +/website_build + +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ diff --git a/example/finisher/analysis_options.yaml b/example/finisher/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/example/finisher/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/example/finisher/bin/finisher.dart b/example/finisher/bin/finisher.dart new file mode 100644 index 0000000..34ba33c --- /dev/null +++ b/example/finisher/bin/finisher.dart @@ -0,0 +1,29 @@ +import 'dart:async'; + +import 'package:static_shock/static_shock.dart'; + +Future main(List arguments) async { + final staticShock = StaticShock() + ..plugin(const MarkdownPlugin()) + ..finish(PickedPagesFinisher(picker: DirectoryPicker.parse("posts"))); + + // Generate the static website. + await staticShock.generateSite(); +} + +class PickedPagesFinisher implements Finisher { + final Picker picker; + const PickedPagesFinisher({required this.picker}); + + @override + FutureOr execute(StaticShockPipelineContext context) { + // a finisher is called after the site is generated and the index containing the picked pages is produced. + // here we're using that index along with a picker to filter the pages in the index to just those filtered by the + // picker. this is the base of what an RSS or ATOM generator would do, i.e. filter some set of generated pages in + // the site to produce an RSS or ATOM feed. + print("Picked Pages:"); + for (final page in context.pagesIndex.pages) { + if (picker.shouldPick(page.sourcePath)) print(page); + } + } +} diff --git a/example/finisher/build/index.html b/example/finisher/build/index.html new file mode 100644 index 0000000..89a3810 --- /dev/null +++ b/example/finisher/build/index.html @@ -0,0 +1,8 @@ +

Hello, world!

+

This title and paragraph were written in Markdown. Then, they were converted into HTML, and inserted +into a Jinja template layout for this page.

+

Posts

+ diff --git a/example/finisher/build/posts/post1.html b/example/finisher/build/posts/post1.html new file mode 100644 index 0000000..e079980 --- /dev/null +++ b/example/finisher/build/posts/post1.html @@ -0,0 +1,2 @@ +

post 1

+

this is post 1

diff --git a/example/finisher/build/posts/post2.html b/example/finisher/build/posts/post2.html new file mode 100644 index 0000000..d792cdf --- /dev/null +++ b/example/finisher/build/posts/post2.html @@ -0,0 +1,2 @@ +

post 2

+

this is post 2

diff --git a/example/finisher/pubspec.lock b/example/finisher/pubspec.lock new file mode 100644 index 0000000..9e3e83e --- /dev/null +++ b/example/finisher/pubspec.lock @@ -0,0 +1,508 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "0816708f5fbcacca324d811297153fe3c8e047beb5c6752e12292d2974c17045" + url: "https://pub.dev" + source: hosted + version: "62.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "21862995c9932cd082f89d72ae5f5e2c110d1a0204ad06e4ebaee8307b76b834" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" + cli_repl: + dependency: transitive + description: + name: cli_repl + sha256: a2ee06d98f211cb960c777519cb3d14e882acd90fe5e078668e3ab4baab0ddd4 + url: "https://pub.dev" + source: hosted + version: "0.2.3" + collection: + dependency: transitive + description: + name: collection + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" + source: hosted + version: "1.17.2" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + url: "https://pub.dev" + source: hosted + version: "1.6.3" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + dart_internal: + dependency: transitive + description: + name: dart_internal + sha256: dae3976f383beddcfcd07ad5291a422df2c8c0a8a03c52cda63ac7b4f26e0f4e + url: "https://pub.dev" + source: hosted + version: "0.2.8" + fbh_front_matter: + dependency: transitive + description: + name: fbh_front_matter + sha256: "18b2f355326ff2b7ebd64eb1d969c091895ffa755ab55ede5de68f59cf115024" + url: "https://pub.dev" + source: hosted + version: "0.0.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + html_unescape: + dependency: transitive + description: + name: html_unescape + sha256: "15362d7a18f19d7b742ef8dcb811f5fd2a2df98db9f80ea393c075189e0b61e3" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + jinja: + dependency: transitive + description: + name: jinja + sha256: "7b6fd9b8420e9db923a0852aa43f688b99381f45caee60b3ba8dcc445d5e60b9" + url: "https://pub.dev" + source: hosted + version: "0.4.2" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + lints: + dependency: "direct dev" + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + markdown: + dependency: transitive + description: + name: markdown + sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + mason_logger: + dependency: transitive + description: + name: mason_logger + sha256: ba82162ab33d58324f040e37f9270bc1b7c00710315b385d1dc2f14917263cbb + url: "https://pub.dev" + source: hosted + version: "0.2.7" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + node_interop: + dependency: transitive + description: + name: node_interop + sha256: "3af2420c728173806f4378cf89c53ba9f27f7f67792b898561bff9d390deb98e" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "4034a02b7e231e7e60bff30a8ac13a7347abfdac0798595fae0b90a3f0afe759" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + sass: + dependency: transitive + description: + name: sass + sha256: fee111a54f302911948ef76948ed6135a52d6027fbbd4b8e30baf104c7efc51f + url: "https://pub.dev" + source: hosted + version: "1.63.6" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + static_shock: + dependency: "direct main" + description: + path: "../../packages/static_shock" + relative: true + source: path + version: "0.0.1-dev.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "67ec5684c7a19b2aba91d2831f3d305a6fd8e1504629c5818f8d64478abf4f38" + url: "https://pub.dev" + source: hosted + version: "1.24.4" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + test_core: + dependency: transitive + description: + name: test_core + sha256: "6b753899253c38ca0523bb0eccff3934ec83d011705dae717c61ecf209e333c9" + url: "https://pub.dev" + source: hosted + version: "0.5.4" + textwrap: + dependency: transitive + description: + name: textwrap + sha256: "342fb85c503a27c68e0dd21f7be35360acf3231f929e0dcb23cc8593d2919c36" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + tuple: + dependency: transitive + description: + name: tuple + sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b8c67f5fa3897b122cf60fe9ff314f7b0ef71eab25c5f8b771480bc338f48823 + url: "https://pub.dev" + source: hosted + version: "11.7.2" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.0.0 <3.2.0" diff --git a/example/finisher/pubspec.yaml b/example/finisher/pubspec.yaml new file mode 100644 index 0000000..965c1e6 --- /dev/null +++ b/example/finisher/pubspec.yaml @@ -0,0 +1,15 @@ +name: finisher +description: Example usage of the finisher method on the pipeline +version: 1.0.0 +publish_to: none + +environment: + sdk: ^3.0.0 + +dependencies: + static_shock: + path: ../../packages/static_shock + +dev_dependencies: + lints: ^2.0.0 + test: ^1.21.0 diff --git a/example/finisher/source/_includes/layouts/homepage.jinja b/example/finisher/source/_includes/layouts/homepage.jinja new file mode 100644 index 0000000..47009ba --- /dev/null +++ b/example/finisher/source/_includes/layouts/homepage.jinja @@ -0,0 +1,14 @@ + + + + + + {{ title }} + + + +
+ {{ content }} +
+ + \ No newline at end of file diff --git a/example/finisher/source/index.md b/example/finisher/source/index.md new file mode 100644 index 0000000..fbf82ad --- /dev/null +++ b/example/finisher/source/index.md @@ -0,0 +1,15 @@ +--- +title: Welcome +description: The homepage for my static website +layout: layouts/homepage.jinja +--- + +# Hello, world! + +This title and paragraph were written in Markdown. Then, they were converted into HTML, and inserted +into a Jinja template layout for this page. + +# Posts + +- [post 1](posts/post1/) +- [post 2](posts/post2/) diff --git a/example/finisher/source/posts/post1.md b/example/finisher/source/posts/post1.md new file mode 100644 index 0000000..31e24c5 --- /dev/null +++ b/example/finisher/source/posts/post1.md @@ -0,0 +1,7 @@ +--- +layout: layouts/homepage.jinja +--- + +# post 1 + +this is post 1 diff --git a/example/finisher/source/posts/post2.md b/example/finisher/source/posts/post2.md new file mode 100644 index 0000000..5814f19 --- /dev/null +++ b/example/finisher/source/posts/post2.md @@ -0,0 +1,7 @@ +--- +layout: layouts/homepage.jinja +--- + +# post 2 + +this is post 2 diff --git a/packages/static_shock_cli/pubspec.lock b/packages/static_shock_cli/pubspec.lock index 40ef0f4..3a41992 100644 --- a/packages/static_shock_cli/pubspec.lock +++ b/packages/static_shock_cli/pubspec.lock @@ -564,9 +564,10 @@ packages: static_shock: dependency: "direct main" description: - path: "../static_shock" - relative: true - source: path + name: static_shock + sha256: "62d9d3b4a34c2d6d4327c30fed85d7a74002b7b18c9eff78a7524fd7919b70cb" + url: "https://pub.dev" + source: hosted version: "0.0.1-dev.2" stream_channel: dependency: transitive diff --git a/packages/static_shock_docs/source/guides/add-a-page.md b/packages/static_shock_docs/source/guides/add-a-page.md index b4ce298..fad030a 100644 --- a/packages/static_shock_docs/source/guides/add-a-page.md +++ b/packages/static_shock_docs/source/guides/add-a-page.md @@ -14,13 +14,18 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- + # Add a Page + A page is a URL-addressable web page. -A page can be configured with a Markdown file, which is the most common approach for repeated content, such as blog posts. A page can also be configured with a Jinja template, which is the most common approach for one-off pages, such as a landing page, or a contact page. +A page can be configured with a Markdown file, which is the most common approach for repeated content, such as blog posts. A page can also be configured with a Jinja template, which is the most common approach for one-off pages, such as a landing page, or a contact page. ## A Page from Markdown + To create a new page, first select a desired URL path. ``` @@ -41,7 +46,9 @@ Inside the Markdown file, add Front Matter configuration, to tell Static Shock h title: My Blog Post layout: layouts/blog-post.jinja --- + # My Blog Post + This is where the main content goes. ``` @@ -53,10 +60,10 @@ dart bin/my_project.dart When running the build, Static Shock takes the following steps: - 1. Finds the Markdown file in the source set - 2. Looks up the layout template referenced by the Markdown file - 3. Fills the template with the data and content form the Markdown file - 4. Places a copy of the filled template HTML file in the correct directory in the build set +1. Finds the Markdown file in the source set +2. Looks up the layout template referenced by the Markdown file +3. Fills the template with the data and content form the Markdown file +4. Places a copy of the filled template HTML file in the correct directory in the build set Continuing with our example, after running a Static Shock build, an HTML file is generated in the build set. @@ -67,6 +74,7 @@ Continuing with our example, after running a Static Shock build, an HTML file is You now have a static HTML page that you can serve to users, and it's available at your desired URL path. ## A Page from a Jinja Template + To create a new page, first select a desired URL path. ``` @@ -86,10 +94,11 @@ Inside the Jinja file, add Front Matter configuration, to tell Static Shock how --- title: Contact Us --- - + + - + {{ title }} @@ -110,8 +119,8 @@ dart bin/my_project.dart When running the build, Static Shock takes the following steps: 1. Finds the Jinja file in the source set -3. Fills the Jinja blocks with incoming data -4. Places a copy of the filled template HTML file in the correct directory in the build set +2. Fills the Jinja blocks with incoming data +3. Places a copy of the filled template HTML file in the correct directory in the build set Continuing with our example, after running a Static Shock build, an HTML file is generated in the build set. @@ -119,4 +128,4 @@ Continuing with our example, after running a Static Shock build, an HTML file is /build/help/contact-us/index.html ``` -You now have a static HTML page that you can serve to users, and it's available at your desired URL path. \ No newline at end of file +You now have a static HTML page that you can serve to users, and it's available at your desired URL path. diff --git a/packages/static_shock_docs/source/guides/compile-sass.md b/packages/static_shock_docs/source/guides/compile-sass.md index 658bc3c..84b4588 100644 --- a/packages/static_shock_docs/source/guides/compile-sass.md +++ b/packages/static_shock_docs/source/guides/compile-sass.md @@ -14,6 +14,8 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- # Compile Sass Sass (also known as SCSS) is a format for defining CSS in a more convenient and extensible way. diff --git a/packages/static_shock_docs/source/guides/copy-assets.md b/packages/static_shock_docs/source/guides/copy-assets.md index 9f03c97..d1885f9 100644 --- a/packages/static_shock_docs/source/guides/copy-assets.md +++ b/packages/static_shock_docs/source/guides/copy-assets.md @@ -14,6 +14,8 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- # Copy Images, CSS, JS A static site typically contains many assets. An asset is a file served by a web server, which isn't a page. diff --git a/packages/static_shock_docs/source/guides/create-rss-feed.md b/packages/static_shock_docs/source/guides/create-rss-feed.md index d5b0303..6bc1eba 100644 --- a/packages/static_shock_docs/source/guides/create-rss-feed.md +++ b/packages/static_shock_docs/source/guides/create-rss-feed.md @@ -14,6 +14,8 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- # Create RSS Feed TODO: \ No newline at end of file diff --git a/packages/static_shock_docs/source/guides/display-directory-of-pages.md b/packages/static_shock_docs/source/guides/display-directory-of-pages.md index 2e79879..3ec2af1 100644 --- a/packages/static_shock_docs/source/guides/display-directory-of-pages.md +++ b/packages/static_shock_docs/source/guides/display-directory-of-pages.md @@ -14,6 +14,8 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- # Display Directory of Pages TODO: \ No newline at end of file diff --git a/packages/static_shock_docs/source/guides/examples.md b/packages/static_shock_docs/source/guides/examples.md new file mode 100644 index 0000000..7e8f3a1 --- /dev/null +++ b/packages/static_shock_docs/source/guides/examples.md @@ -0,0 +1,23 @@ +--- +title: Examples +layout: layouts/guides.jinja +docs_menu: + - title: Add a Page + id: add-a-page + - title: Copy CSS, JS, Images + id: copy-assets + - title: Compile Sass + id: compile-sass + - title: Display Directory of Pages + id: display-directory-of-pages + - title: Use Remote CSS and JS + id: use-remote-css-and-js + - title: Create RSS Feed + id: create-rss-feed + - title: Examples + id: examples +--- + +# Examples + +- [finisher.dart:](https://github.com/Flutter-Bounty-Hunters/static_shock/tree/main/example/finisher/bin/finisher.dart) add a custom "finisher" to the pipeline, which is run after the site is generated and the index of generated pages and components is produced diff --git a/packages/static_shock_docs/source/guides/use-remote-css-and-js.md b/packages/static_shock_docs/source/guides/use-remote-css-and-js.md index c7e7fbf..c05e739 100644 --- a/packages/static_shock_docs/source/guides/use-remote-css-and-js.md +++ b/packages/static_shock_docs/source/guides/use-remote-css-and-js.md @@ -14,6 +14,8 @@ docs_menu: id: use-remote-css-and-js - title: Create RSS Feed id: create-rss-feed + - title: Examples + id: examples --- # Use Remote CSS and JS TODO: \ No newline at end of file