How do I add a banner area in Sphinx? - python-sphinx

I'm using Sphinx to document my open source project. I'd like to add an area above the navigation bar with links to the project on GitHub, my project home, etc. The Sphinx home page has pretty much what I want where it has "Home", "Get It", "Docs", "Extend/Develop".
The conf.py file has a ton of options, and then there are themes, templates and more. It seems like it should be simple, but I'm not seeing it.

I cloned the Sphinx project on GitHub to find the answer.
If you extend a theme, you can add links to the layout.xml file. The Sphinx docs have this:
{% block header %}
<div class="pageheader">
<ul>
<li>Home</li>
<li>Get it</li>
<li>Docs</li>
<li>Extend/Develop</li>
</ul>
<div>
<a href="{{ pathto('index') }}">
<img src="{{ pathto('_static/sphinxheader.png', 1) }}" alt="SPHINX" />
</a>
</div>
</div>
{% endblock %}

Related

Avatar Not Showing Laravel

I'm working with laravel framework, I have to create a profile so I changed the table User created in the Auth.. all works perfectly. I also added a Picture for the Profile picture or Avatar in the User table.
I made a profile page Image are showing and even to my nav bar.
this is the code I used.. and it work in other pages.
<img src="img/avatar/{{Auth::user()->picture}}">
this one is for my logo image I put the {{URL::asset}} because it's not showing also in another pages
<img src="{{ URL::asset('img/weblogo.png') }}">
then it works perfectly in all pages
but when I try to use it in the image from my database, It won't work and said
<img src="{{ URL::asset('img/avatar/{{Auth::user()->picture}}') }}">
syntax error, unexpected '}', expecting ')'
in my view
but when I try this, it won't work with all the pages
<img src="img/avatar/{{Auth::user()->picture}}">
Set asset as below
<img src="{{ asset('img/avatar/'.Auth::user()->picture) }}">
Or if you want to use URL::asset then
<img src="{{ URL::asset('img/avatar/'.Auth::user()->picture) }}">
You don't need to use {{ again inside {{ }}
Change
<img src="{{ URL::asset('img/avatar/{{Auth::user()->picture}}') }}">
to
<img src="{{ URL::asset('img/avatar/'.Auth::user()->picture) }}">

OctoberCMS -> Access to a different Pages->Content Tab

i have a small problem. I created a partial that gives me out all pages. Now i want to give out the Content from the different Pages. All pages have a tab that named "Image", but i don't know how access to
Layout
{% for child in page.getChildren %}
<li class="list-group-item">
<span>
<!-- Here the Content of the Tab "Image" -->
</span>
<a href="{{ child.url|app }}">
ClickMe
</a>
</li>
{% endfor %}
Page
So can you help me to access to the right Tab? I already tried these one (but i only can access to the content tab)
{{ child.content }}
this doesn't worked for me
{{ child.Tab.Image }}
or
{{ child.Image }}
If you use placeholder, you can only insert text in backend newly created tab. The best way to create an image custom field in your page (I assume that you are using Static Pages plugin, like you photo suggests) is use this syntax:
{variable name="image" label="Image" tab="The name of your tab here" type="mediafinder" mode="image"}{/variable}
Remember to put this code in you layoutfile.
You can find all of your needs in plugin's documentation here and here.
Remember that you can use all of OctoberCMS's built in form fields (yeah, also repeater!)

Disabling the top navigation bar (breadcrumbs) in Sphinx ReadTheDocs theme

I would like to disable the top navigation bar of the ReadTheDocs theme. For other theme, for instance classic it is just an option
html_theme = "classic"
html_theme_options = {
"showrelbartop": False
}
How I can modify the read the docs theme to disable this top navigation bar?
Edit:
After processing the source files with make html, I have to remove these lines in html files
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li>Docs »</li>
<li></li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
to obtain the expected result. Is it possible to obtain this result before compiling the sources with make html?
I assume you refer to the breadcrumbs (breadcrumbs.html). You can simply open the main template file - layout.html - and delete or comment out the following line:
{% include "breadcrumbs.html" %}
An old question, but I needed this as well. A simpler answer than the currently accepted one, which works for Sphinx==3.5.3 and sphinx-rtd-theme==0.5.2 is:
in docs/_templates/, create a file called breadcrumbs.html
in that file, write an html comment like <!-- Empty override file take the place of env/lib/python3.8/site-packages/sphinx_rtd_theme/breadcrumbs.html, which generates the top nav breadcrumbs. -->.
Rebuild, and you're done.

Passing a front matter variable to a Liquid::Block parameter

I am trying to make a jekyll blog with github-pages.
In order to get some pictures from a folder, I used this gist: https://gist.github.com/jgatjens/8925165
Now, I want to make it a little bit more flexible so that it would get a front matter variable ( page.folder ) and would return the images from there.
My problem is that whenever I assign a folder variable to the front matter and then pass it to the block like this:
{% loop_directory directory:page.folder iterator:image filter:*.jpg sort:descending %}
<div class="item">
<a class="content" href="{{ site.baseurl }}/{{ image }}" title="portfolio 2015">
<img src="{{ site.baseurl }}/{{ image }}"/>
</a>
</div>
{% endloop_directory %}
In the directory attribute it passes page.folder instead of, for example "images/portfolio" which is defined on the front matter. I am rather new at ruby so I can't find something refered to that problem. Is it a bug or something that I need to write correctly to pass the variable?
Did you tried:
{% loop_directory directory: {{page.folder}} iterator:image filter:*.jpg sort:descending %}
I had figured it using the context object to get the front matter attributes,
but unfortunately github / github-pages do not accept plugins (_plugins folder), so a day was wasted for that.
I resolved to github's solution, to create a _data folder and use a text-based (yaml) format to list all my extra assets in an organized way.

Jekyll, include markdown with layout in html

I have a website that consists out of a few 'slides'. Each has a fixed structure, used by some scripts, but variable content. I'm hosting it on github and am now trying to use Jekyll to make it easier to add new slides.
I already have each slide in a different html file, which I include in the main page: {% include_relative _slides/about.html %}. Now I'm trying to make it a markdown file, and I wanted to use front matter to make a layout that each slide's file could use. I can include a markdown file, and get it to render by doing:
{% capture myInclude %}{% include_relative _slides/test.md %}{% endcapture %}
{{ myInclude | markdownify }}
However, when I add a front-matter block to it with a layout defined in it, the layout doesn't get applied. It just gets rendered as a horizontal line (for the first ---) and then "layout: slide title: Test Slide —" in plain text.
Is there any way to fix this? Or perhaps a better way to break up my index.html and the slides in it?
Thanks a lot!
Note: Sorry if this was asked before, I Googled everything I could imagine it would be called.
I found something that works for me. I divided my template in two parts, the part above the content, and the part under it. Then in the file I include, there are two includes as well, one at the top and one at the bottom.
So my 'slide' files look like this:
{% include slide_start.html title="About" image="images/about.jpg" %}
... the content of the slide ...
{% include slide_end.html %}
As you can see, in the first include I give some parameters, these will be filled in and can be accessed with the liquid tags {{ include.something }}.
My slide_start.html looks like:
<div class="slide">
<div class="header">
<span>{{ include.title }}</span><!-- no whitespace
--><img src="{{ include.image }}" alt="{{ include.title }}"/>
</div>
<div class="content" markdown="1">
the slide_end.html is just two closing div tags.
You're trying to mix the page/post and the include strategies.
Page/post have a front matter and are decorated with a template, which can itself be decorated. `mypage.html -> layout: page -> layout: default.
Includes are included in page/post but they are only code parts. They cannot be decorated with a template.
You will have to choose.
Take a lool at https://github.com/shower/jekyller this can be helpfull.

Resources