Add left navigation bar on github pages with .md files - github

I want to create some documentation for our project in GitHub.
I can see, that GitHub already provides these options with GitHub pages. In the intro video, I can see that you can and multiple pages (.md files) and navigation.
I already add Jekyll.
But:
I can't find how to add a left navigation bar
how to organise files so that it will know where to find other pages
Right now I have
-> Root
|
-> _config.yml
-> about.md
-> index.md
-> README.md
-> docs
|
-> first_page.md
-> second_page.md
The config file I have
title: title
description: YOUR DESCRIPTION
baseurl: 'our_domain'
kramdown:
math_engine: mathjax
syntax_highlighter: rouge
plugins:
- jekyll-default-layout
# Navigation
# List links that should appear in the site sidebar here
navigation:
- text: Documentation
internal: true
url: ./docs

The just the docs theme mentioned by Benjamin includes a sidebar in the default layout using {% include components/sidebar.html %} This sidebar.html is very interesting but a quite complex example on how to do it, including other files, etc.
In short:
Adjust your layout.
Loop over some kind of data file, or in your case site.navigation
Use the returned information (text, internal, url) and include it in your sidebar.
Very simple example:
<nav>
<ul>
{% for item in site.navigation %}
<li>
{{ item.text }}
</li>
{% endfor %}
</ul>
</nav>
The Jekyll docs include simpler examples on how to loop such files. The docs also explain how to use a YAML file in the _data folder for this instead.

Related

How can i add class inside content on TWIG - Drupal

I have this div
<div class="col-md-6 column_must">
<p class="must_title"> {{ content.field_code_must_title }}</p>
<p class="must_desc"> {{ content.field_code_must_desc }}</p>
</div>
I want to insert this 2 class in content, but the result shows the then the content, but i want the content inside in that
Can you help me?
Thanks
You will need to add a twig file to edit the fields field_code_must_title and field_code_must_desc, there you'll be able to add your classes to the fields.
What I would suggest you is on the custom theme folder that you will have on your drupal installation, create the twig files for these two fields and then copy inside the field.html.twig from the drupal core theme and make the changes in place.
Follow this link for more insights:
https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-for-custom-module

using category tags in a nav bar on landing page

I have build a landing page to show case recipes using the product and products document types from Umbraco starter kit.
On the single recipes I put some category tags for the purpose to make them appear in a nav bar on the landing page.
I would like to use some code similar to this
<nav class="nav-bar nav-bar--center nav-bar--air-bottom">
<a class="nav-link nav-link--black nav-link--active" href="">All</a>
<a class="nav-link nav-link--black" href="">Vorspeisen</a>
<a class="nav-link nav-link--black" href="">Suppen</a>
<a class="nav-link nav-link--black" href="">Eintoepfe</a>
<a class="nav-link nav-link--black" href="">Hauptgerichte</a>
<a class="nav-link nav-link--black" href="">Deserts</a>
</nav>
I am sure that the above code won't work as it is right now. I have some basic experience with HTML but have no real clue about Razor and how to use the Umbraco Aliases etc.
I know what the above will build a nav bar on my landing page what I want. So that's fine. Only issue I have is that I don't know what to code to use in "" here: href="" to fetch the category tags instead of using a URL for a landing page which is not what I want and also not the ID of a property as I do not have an ID for each tag??? Or where may I find an ID of the tags I create on the content like shown on the screenshots below?
How can I fetch the category tags for the nav bar
Would really appreciate some help as I am no developer
Adding some screenshots to show what I am trying to use:
property on document type
actual category tags examples I want to use
As mentioned before, I am no developer so might need to share some more info to get the guidance I need. So if anybody would be willing to help but wants/needs to see some more code please just let me know what to share and I'll be happy to share what might be needed.
Update 16/02/19:
Structure would look like this:
Home
| -landingpage
| -parent landingpage (that's the page I want to use a nav bar that
filters the childs
| -child elements
| -landingpage
Tree Structure and structure of the landing page in question
pretty similar to a classic blog page.
I have used the default products template and product template from the Umbraco starter kit. and altered this a bit to fit my needs.
This works perfectly fine for my purpose.
I can't understand much since it's not in English but you should be able to do this in your view:
#{
rootPage = Model.AncestorOrSelf(1);
}
#foreach (var child in rootPage.Children) {
var categoryTag = child.GetPropertyValue<string>("category");
<div>#categoryTag</div>
//do whatever else you want in there with the category tags.
}
Here's the cheat sheet for traversing in Umbraco
Make sure you visit the cheat sheet to find different ways of traversing.
.Children is for the children (in the tree structure) of your current page.
.Descendants is for any node under your current page.
.Descendants("nodeAliasHere") is to find any descendant with a specific DocumentTypeAlias under your current page.
The idea behind the code should be: 'Go to the root page, get a descendant page, then find the property with value 'category''.

TYPO3: 2 news plugins on 1 page get mixed up

I have a page that consists of 2 news plugins (extension key = "news", typo3 version = "6.2.38"). I have created those 2 plugins in the backend. Both news plugins have the same folder as their source of articles. I have assigned "categories" to the articles inside the source folder. Now the the first plugin is supposed to show the articles of category "A" and the second plugin is supposed to show the articles of category "B".
Both plugins activated:
If both plugins are activated, all articles ("A" and "B") appear underneath the title of plugin 2. Plugin 1 only shows its title without any articles below it.
Only plugin 2 activated:
I only see articles of category "B" as expected.
Only plugin 1 activated:
I only see articles of category "A" as expected.
EDIT: Here comes the structure of the resulting HTML. "c1" is the content element of the first plugin and "c2" is the content element of the second plugin.
<div id="c1" class="csc-default">
<div class="csc-header csc-header-n1"><h2 class="csc-firstHeader">Articles of plugin 1:</h2></div>
<div class="news">
<div class="news-list-view">
.
. one div for each article
.
</div>
</div>
</div>
<div id="c2" class="csc-default">
<div class="csc-header csc-header-n1"><h2 class="csc-firstHeader">Articles of plugin 2:</h2></div>
<div class="news">
<div class="news-list-view">
.
. one div for each article
.
</div>
</div>
</div>
It looks like everything is in correct order. However, what I see in the browser is (in this order): 1) "Articles of plugin 1:" 2) "Articles of plugin 2:" 3) ALL the articles of BOTH plugins.
if the HTML provided by the server is correct (as your code shows) the display can be influenced by two things:
CSS
Javascript
invalid HTML
possible problems with CSS can result from floats (or positions), which show content out of order in HTML.
with Javascript you can modify the build DOM, so elements are positioned in other order than originaly given.
Browser try to fix broken HTML, this might result in elements boxed inside each other than in line.
All possibilities can be examined with tools like Firebug. compare the DOM-Code with the original server-code (CTRL-U). Differences result from javascript or invalid HTML (e.g. missing closing tag).
CSS tweaks can be found inspecting the CSS of each element for CSS properties.

Github pages: How to extend base layout?

In my github pages directory, I have a folder called _layout in which I have a template file called base.html.
It contains nothing more than:
<p>Test 1</p>
{{ content }}
<p>Test 2</p>
In each of my markdown pages (test.md), at the top of the file I have the following:
---
title: TEST PAGE
layout: base
---
<p>Test Page Content</p>
However, when I go to serve this website and I go to test.html, all that appears is the contents of the test page - it does not place itself in the layout defined by base.html.. what am I doing wrong? Thanks!
The folder should be called _layouts, with an s.

Highlight current menu item lift

How can I determine the page I am currently on in Lift?
In django, for example, in my base template I had simple checks like these:
<li {% ifequal main_navigation "home" %} class="selected"{%endifequal%}>
Home
</li>
<li {% ifequal main_navigation "risk"%}class="selected"{%endifequal%}>
Risk
</li>
<li {% ifequal main_navigation "contact" %}class="selected"{%endifequal%}>
Contact
</li>
here, the if determines what the context variable main_navigation is set to.
I'm assuming you're using the sitemap for your menu.
When rendering the menu with the Menu.builder snippet you can use additional parameters to further tweak the menu. This example will render only the first level of the menu and adds class current to the menu item if it's the current page.
designer friendly example:
<div class="lift:Menu.builder?level=0;expand=false;li_item:class=current"></div>
or
<lift:Menu.builder li_item:class="selected" level="0" expand="false" />
for more details see the lift wiki: http://www.assembla.com/wiki/show/liftweb/SiteMap
If you use Lift's SiteMap and Menu functionality, I think this is taken care of automatically. You can read about it here: http://simply.liftweb.net/index-3.2.html#toc-Subsection-3.2
To answer your broader question, within a Snippet (not a template), you can use LiftRules.context, which returns an HTTPContext including a path attribute.