mkdocs build output includes all files when it should not - mkdocs

I am using material-mkdocs. It has been working great for a single site. I would now like to generate two different sites based on the same content, just selectively picking what content is in each site by customising the nav: in the mkdocs config file.
Goal:
Site1: Target Audience A (Show all pages, all nav)
Site2: Target Audience B (Only show 1 page, very simply nav)
I have this working by using:
Site1 = mkdocs build -v -d builtdocs_site1 -f /docs/mkdocs-site1.yml
Site2 = mkdocs build -v -d builtdocs_site2 -f /docs/mkdocs-site2.yml
mkdocs-site1.yml
nav:
- Home:
- Home: index.md
- More: more.md
- more2: more2.md
- lotsmore: lotsmore.md
mkdocs-site2.yml
nav:
- Home:
- Justone: index.md
This results in:
Site1: When I open /docs/builtdocs_site1/index.html I see the 4 nav options which is the expected/desired outcome.
Site2: When I open /docs/builtdocs_site2/index.html I see the 1 nav option which is the expected/desired outcome.
The Problem:
When I build these sites the output includes all files regardless of what is specified in the nav: sections of the respective yml files.
Site1:
/docs/builtdocs_site1/
- index.html
- more.html
- more2.html
- lotsmore.html
Site2:
/docs/builtdocs_site1/
- index.html
- more.html
- more2.html
- lotsmore.html
This means that site2 actually has the content from site1 and even though it cannot be easily accessed (no links), it is still accessible to anyone who can list/view the directory (which in my case is true for various reasons).
How can I configure mkdocs to only build files that are specified in the nav:?

Related

It wont render my website and its template to localhost1313

(Hugo)
I'm receiving this in the terminal when I attempt to run the LocalHost server:
Veers-MacBook:FullFork veergala$ hugo server
Building sites … WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/11 09:15:11 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
| EN
-------------------+-----
Pages | 3
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Built in 33 ms
Watching for changes in /Users/avinashgala/FullFork/{archetypes,content,data,layouts,static}
Watching for config changes in /Users/avinashgala/FullFork/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
WARN 2020/09/11 09:15:32 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
I am new to Hugo/Terminal and I have no idea what to do.
Thank you for your time.
Each of your page has a "Kind": see "Page Kinds"
Hugo looks for a layout in order to render your site:
See "Hugo's Lookup Order"
If you don't have your own layout folder, with those _default layout pages, you can add declare a theme
The name used in the theme definition above must match a folder in /your-site/themes, e.g. /your-site/themes/my-shortcodes.
See "A Beginner’s Guide to Creating a Static Website with Hugo" by Ilya Bodrov as an example.
Don't forget to do:
hugo server -D
The -D option means that drafts should also be displayed on the website.
By default, all content is created in draft mode, so we have to provide this option for now.
This command will display brief statistics about your site and start the server with live reloading enabled. Live reloading simply means that whenever you modify the code, the web page will reload automatically in the browser.

Mkdocs site is opened incorrectly

I've got mkdocs.yml file which looks like:
site_name: blabla
pages:
- One page: page2.md
- Second page: page2.md
- Navigation: Navigation.md
When I open it url is like this: http://10.2.0.8/blabla/master/Navigation.md and doesn't work and I get 404 Not Found
nginx/1.14.0 (Ubuntu) error. If I delete .md at the end of url it works fine.
However, on locally it opens like http://127.0.0.1:8000/Navigation/
does anyone know what's the problem with this?
As described in the official mkdocs documentation, the intended behavior is that http://10.2.0.8/blabla/master/Navigation.md does not exist, but rather http://10.2.0.8/blabla/master/Navigation as shortcut for http://10.2.0.8/blabla/master/Navigation/.
What might have gone wrong in your case is the deployment of the HTML & CSS files. Assuming that your markdown sources are in ~/blabla, a mkdocs build --clean within that directory will create a subdirectory ~/blabla/site/ which you then have to deploy in the respective directory, say /var/www/html/blabla/. Under Linux, I suggest a rsync -r --delete-before ~/blabla/site/* /var/www/html/blabbla/. In other words: The issue might also be that you simply have not deployed the whole site or at a different place.

Where to find default layouts in Jekyll

The default site setup for a new Jekyll site has a layout specified as "home" in index.md:
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---
If I follow the link, it tells me to create a _layouts folder and create a file in it named home.html and that will be used as the home layout. But if that file doesn't exist Jekyll defaults back to the normal home page.
Where is Jekyll pulling the default layout from?
This default layout comes from the theme, which is gem based and is stored on your computer.
To locate a theme’s files on your computer:
Run bundle show followed by the name of the theme’s gem, e.g., bundle show minima for Jekyll’s default theme. This returns the location of the gem-based theme files. For example, the Minima theme’s files might be located in /usr/local/lib/ruby/gems/2.3.0/gems/minima-2.1.0 on macOS.
Source
I would suggest to start without a theme. Invisible files do not really help you to understand an already quite abstract concept. Remove the theme and write your own layouts and CSS. When you get how it works, you also truly understand how a theme works and what it can and cannot do.
Removing the standard (or any other) theme is simple. Just go to the _config.yml file and remove theme: minima. Now you will use only visible files. You might also want to remove the 'Gemfile', but that requires you to also remove the 'jekyll-feed' plugin from the config. No problem, as you can easily roll your own: https://jekyllcodex.org/without-plugin/rss-feed/
From this version of the manual:
Run bundle info --path followed by the name of the theme's gem, e.g., bundle info --path minima for Jekyll's default theme.
The layout files will be in the _layouts sub-directory of the path returned by the command above.

How to generate a whole website in a variabilized sub-directory ? (Jekyll)

I've been playing around with Jekyll lately and recently discovered that S3 wouldn't allow me to have enough buckets to have one bucket per website.
So I'm struggling to figure out two things
1) How do I specify that I want a 'child' subdirectory to be created, and all the generated website's files to be in it ?
2) How do I use a variable as the 'child' subdirectory's name ? (since it will be different for each website)
The baseurl config option doesn't seem to do anything about that. Any idea will be welcome :-)
Thanks a lot, and have a great day !
I'm not sure about the variable option, however, for child sub-directories:
A) If you can put the content into "child" folders directly within the jekyll content, then use different configuration files to manage each site through build properties. See the examples under the example below.
B) If you just want to put the same content in different places, perhaps you could use different baseurl or destination properties in different config files? Use the same config file approach as below, but with different versions of those properties instead of/in combination with the exclude property (see https://jekyllrb.com/docs/configuration/#serve-command-options).
Example: Use different config files
Use the exclude config property to exclude folders (and all of that folder's contents) when running a build. You could also specify different output folder locations per site, base URLs, and so on. I'll focus on the exclude property, but you can find other useful properties in the documentation: https://jekyllrb.com/docs/configuration/#global-configuration
For example, you could have the following files/folders:
/siteA-folder/siteA-content/blah.html
/siteB-folder/siteB=content/meh.html
/siteC-folder/siteC=content/foo.html
config.yaml
config_buildA.yaml
config buildB.yaml
Use the build option --config FILE1[,FILE2...] (https://jekyllrb.com/docs/configuration/#build-command-options) to explicitly call your custom config file A or B, each of which has its own version of the exclude property.
Snippet from config_buildA.yaml:
exclude:
- /siteB-folder/ # While building A, you want to exclude the siteB folder and contents
- /siteC-folder/ # Similarly, exclude siteC contents
Snippet from config_buildB.yaml:
exclude:
- /siteA-folder/ # While building B, you want to exclude the siteA folder and contents
- /siteC-folder/ # Similarly, exclude siteC contents
Building A from the command line:
jekyll build --config config_buildA.yaml
Building B from the command line:
jekyll build --config config_buildB.yaml
By managing excludes in the config file, you can re-use the common templates and css, and keep everything together (using less disk space overall).
If there's shared content, you could also look into using a more advanced feature, includes (see https://jekyllrb.com/docs/includes/), to manage the shared content in the includes folder, referenced within the html or markdown files (but that's getting a little of the beaten track for your question, so I'll stop there...)
EDIT: I see you've edited the question specifying the baseurl property doesn't do what you're looking for.
I've used a combination of the url site property baseurl and destination similar to below. In my case, I have different destinations depending on whether it's an archive or latest content, but you could use this to build to different web folders if you wanted.
Ex: config for latest content
url: http://example.com
baseurl: "/latest/"
destination: /path/to/latest/output/
Ex: config for archived content
url: http://example.com
baseurl: "/archive/content/"
destination: /path/to/archive/output/
Then, using the multiple versions of the config file, I can just call whichever one applies.

How to include only a single folder in Bamboo build plan

I need Bamboo to build the project automatically when a file in "api" subfolder changes. When a file in any other subfolder changes the bamboo build plan shouldn't run.
Folder structure:
project
- api
- ui
- core
In the Plan Configuration repositories tab, from the "Include / exclude files" dropdown I have selected the following option
Include only changes that matches the following pattern
and I have tried the following patterns:
.*/api/.*
api/
api/*
api\/*
api/**
/api/*
but the build plan isn't running. With "Include / exclude files" dropdown set to None the build plan runs (but does so when a file changes in any other subfolder also)
I can't split the project up to different repositories.
What pattern should I use or is there any other solution for this?
Pattern that ended up working was
api/.*
It's a regular expression from the root of the checkout supposedly, although I have not used this feature. Here are some of their examples:
https://confluence.atlassian.com/display/BAMBOO052/_planRepositoryIncludeExcludeFilesExamples?_ga=2.91083610.1778956526.1502832020-118211336.1443803386
What you might try is let it checkout the whole thing without the include filter set, and don't let it delete the working directory. Look on the filesystem and verify the path from the root of the working directory. Then test your regex against the whole path relative from that working directory.