How to make subdirectory collections in Jekyll? - web

I have a Jekyll site and I want to make collections but with subdirectories
For example, I have kind of this structure:
......
_projects/ # "mysite.domain/projects", contains list of available projects (based on these directory)
├── lineageos # "mysite.domain/projects/lineageos"
├── twrp # "mysite.domain/projects/twrp"
└── ungap # "mysite.domain/projects/ungap"
Is there a way to achieve this? I have read the Jekyll collections docs, but I can't understand it all and apply it for this.
Thanks! Let me know if you need more details.
Note: The things that making me confused is config file and markdown/layout structure for this kind of collections. So it will very appreciated if you tell me about this with detail :)

You have to include the projects folder in the _config.yml and set the output to true. The sort_by is optional.
The collection folder must start with underscore _ so rename the folder to "_projects" instead of projects.
collections:
projects:
output: true
sort_by: title
See the hint box of the jekyll docu - collections
Be sure to name your directories correctly
The folder must be named identically to the collection you defined in your _config.yml file, with the addition of the preceding _ character.

Related

Hide project from dbt docs

We have a dbt project with a single project folder. However, when running dbt docs generate and then serve up the results, two project folders are shown under Projects: Our project, and dbt_spark. The dbt_spark folder lists macros that are defined by the dbt-spark python package. Now, dbt-spark is a dependency for our project (we are using Databricks as backend), but none of the macros are used in our transformations.
Any ideas how to hide the dbt_spark - project? I guess it is possible to use sed to filter references to dbt_spark, but was hoping for a better solution...
Looking at the file manifest.json, there is a "docs": {"show": true} property for each `macro.dbt_spark.xxx´ macro-element in the file. I changed these elements to false with a short python-script. Now, only our own project is displayed under Projects...
Just tweak your dbt_project.yaml
models:
dbt_spark:
+docs:
show: false
your_project:

Exclude directories using python dirsync module

I want to sync two different directories using the dirsync module, but exclude some specific folders.
In the documentation (https://pypi.org/project/dirsync/) it says the exclude need to be a regex pattern but I cant quite make it work.
For example, lets say we have these directories
c:\folder1\folder2
c:\folder1\folder3
d:\folder1\
I want to sync c:\folder1\ with d:\folder1\ and exclude folder3, so basically the folder c:\folder1\folder2 will be copied and created in d:\
from dirsync import sync
src = r'c:\folder1'
dst = r'd:\folder1'
sync(src, dst, 'diff', exclude='^folder3')
this won't work and I can't quite understand why.
The exclude option expects a list of regexp:
exclude=['^folder3']

globbing pattern to copy files from a particular folder within another folder

I have the following directories tree:
- client
- plugins
- plugin1
- plugin2
- plugin3
- widgets
- widget1
- widget2
- resources
- img
I need to copy all files from resources belonging to any particular plugin widget into one folder using grunt copy, so I'm using the following globbing pattern to find those files:
src: 'client/plugins/**/*/resources/img/*'
But it doesn't seem to be able to find them, so I guess the pattern is wrong. Where is my mistake?
I don't think you can use a specific directory after using the ** pattern because that already matches any subfolder. I think you'll need to be more specific:
src: 'client/plugins/*/widgets/*/resources/img/*'
If you can't use "widgets" exactly, then you'll need to find another alternative, maybe just using another /*/. You can find all of the globbing options in the node-glob Github repo README file. This includes things like anti-patterns if it comes to that.

Puppet how to run all manifests in directory

So I have a directory of puppet manifests that I want to run.
Is it possible to do something like:
include /etc/puppet/users/server522/*.pp
and have puppet run them?
I've tried
include users::server522::*
and several other variations
I always get an error about puppet being unable to find it.
Is there anyway to do this?
So my final solution to this was write a script that would take the directory listing and for each .pp file add an include into the server522.pp file. Quite annoying that puppet won't include an entire directory.
What are you trying to do here, and are you sure you're doing it the correct way? To wit, if you have multiple manifests corresponding to multiple servers, you need to define the nodes for each server. If OTOH you're trying to apply multiple manifests to a single node it's not clear why you would be doing that, instead of just using your defined classes. A little more information would be helpful here.
I do not see the point of each user having its own manifest. I would rather create script that would automatically build one manifest file, basing on data from some source, for instance from HEAD of git repository containing CSV file with current list of users.
If you realy want to use separate manifest file for every user you may consider having seprate module for every user:
manifests
default.pp <-- here comes default manifest
module_for_user_foo/
manifests/
init.pp <-- here comes your 'foo' user
module_for_user_bar/
manifests/
init.pp <-- here comes your 'bar' user
Now you may copy modules containing manifests.

Reorganize directory structure MVC ExtJs 4 App

I have learned from the sencha doc how to create a simple MVC application, and now I wonder if it is possible to move from this structure :
-app
--Controller
---controller1.js
---controller2.js
...
--Model
---model1.js
---model2.js
...
--Store
---store1.js
---store2.js
...
--View
---view1.js
---view2.js
...
to this modular structure :
-app
--Module1
---controller.js
---model.js
---store.js
---view.js
--Module2
---controller.js
---model.js
---store.js
---view.js
I want also if you can advise me about the modular structure (good, bad, complex, remarks...), Thank you in advance.
You can do whatever you want with different file and class names. Just remember to keep class name in sync with its position in the file hierarchy. For example if you have class
MyApp.controller.Controller1
located in the following file
- app\Controller\Controller1.js
If you move it to the
- app\module1\Controller.js
You would need to rename class name to
MyApp.module1.Controller
See for yourself whether having such class hierarchy would be appropriate for you. I would not do this. We keep all code according to ExtJs MVC directory structure (mostly). We have the following directories
- store
-- base
- view
-- base
- controller
- model
We usually put base classes underneath special base director to easily separate them from the rest of code.

Resources