Comments (4)
Hello, I'd like to work on this. I was thinking about two possible approaches.
Approach 1 - Create a templates/themes/
allowing you to access components from possibly multiple themes by including partials like {{> themes/<name of theme>/<theme component> }}
. Alternatively themes/
can be a separate directory from where all the templates are registered and can be included using `{{> / }}
Approach 2 - Creating separate themes/
and using the configuration in site.toml
to pick the themes in theme/<name of theme>/
as described originally with the user templates having higher precedence than the theme-defined templates allowing for the user to override the theme where required.
Approach 1 would allow for more flexibility as it can allow for multiple themes to be used at the same time while approach 2 might lead to a smaller solution.
from bartholomew.
Hi, @karthik2804!
Working on this would be great!
I'm familiar with Hugo as a static site generator, and approach 2 is what I would expect.
That being said, exploring the first approach and seeing whether it leads to a simpler solution is something I'd like to explore as well.
Thanks!
from bartholomew.
Hello @radu-matei!
I have implemented both approaches as described in the earlier comment on separate branches.
Approach 1 which is component-based can be found at Component-based approach while approach 2 which is an individual Theme-based approach can be found at Theme-based approach .
The pros of approach 1 are
- It allows for more flexibility.
- Allows borrowing components from more than one theme
- No namespace clashes of the components as the partials are included as {{> / }} while templates are chosen as {{> }}
The possible cons of approach 1 are
- It may slow down the response as it needs to index more templates as it reads all the themes available.
an example of usage of approach 1: The navbar is provided by the template of theme-2 ( {{> theme-2/navbar }}
) while the sidebar is provided by the template in theme-1 ( {{> theme-1/sidebar }}
).
The pros of approach 2 are
- It is simpler in that a single theme is chosen.
The cons of approach 2 are
- It does not have the flexibility available in approach 1 to use components from multiple themes.
an example of usage of approach 2 is that the selected theme is defined using the site.toml configuration. If there is no theme defined only the user-defined tempaltes are loaded. When a theme is mentioned on site.toml, the templates of the theme are loaded along with the user-defined templates.
A thing to note is that there will be a namespace collision of the templates in approach 2, where the user-defined templates take higher precedence than the templates provided in the themes, This allows the user to override the theme wherever required.
from bartholomew.
closed by #87
from bartholomew.
Related Issues (20)
- Bartholomew crashes when trying to use `tweet` embed in templates HOT 11
- Configuration settings - documentation update HOT 2
- Issues building from quickstart instructions HOT 4
- Documentation update - template function HOT 1
- Gluon HOT 3
- Bart CLI does not build on Windows HOT 4
- Add v0.4.0 `bart` CLI binary executable for macOS - AArch64 HOT 2
- relative link without url scheme
- .md is removed from external links
- Issue reading content HOT 4
- missing dependencies HOT 1
- make bart: make: *** [bart] Error 1 HOT 3
- Cannot create Cache file HOT 4
- Create dynamic template feature HOT 4
- Problem compiling with latest Rust on Windows HOT 1
- Include non-Linux `bart` binaries in releases HOT 1
- "Operation not permitted" (Mac OS error 63) unless `--allow-transient-write` HOT 4
- Set a publish date at fragment level not just page level HOT 2
- feature request: bart plugins HOT 1
- Support linking to specific sections of a blog post HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bartholomew.