My Problem
I am building a Jekyll static site using the jekyll-materialize-starter-template.
The home page contains an h1 title in the front center:
Which reads Your awesome title, and defined in _layouts/home.html:
<h1 class="header center orange-text">{{ site.title }}</h1>
How can I set the value of site.title?
What have I tried
Searched for site.title and title
Read the docs about variables
Hard-code my title. Works, but it feels like the wrong thing to do - variables should be properly set.
My question
How can I set the site.title variable used by a Jekyll template?
Edit _config.yml and locate the title key:
title: Starter Template
or
title: Your awesome title
and change that value.
If you are developing with a local server, restart the jekyll server to reflect changes to config.
Related
How to set a custom/editable sitename and site discription in Django CMS.
The sitename and discription should be editable via Django CMS!
Check the image
I'm not entirely sure what you mean, but if I understand you correctly, you want to
put a placeholder in your template and
add a text plugin to that via the structure view.
<!-- your template, e.g. base.html -->
{% placeholder "title" %}
Then, in your structure view (button at the top right in your screenshot) you should see the placeholder and be able to add a text plugin with the title there.
I watched a tutorial video in Linkedin Learning about how to integrate a FLUID Template.
I created a FLUID Template. But the template doesn't display on the page.
My structure
typo3conf/ext/october
typo3conf/ext/october/Typoscript/Configuration/page.setup.ts
typo3conf/ext/october/Typoscript/Library/setup.ts
typo3conf/ext/october/Typoscript/Library/constants.ts
typo3conf/ext/october/Resources/Private/Layouts/Default.html
typo3conf/ext/october/Resources/Private/Templates/Default.html
page.setup.ts
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
templateName = Default
templateRootPaths.10 = EXT:october/Resources/Private/Templates
layoutRootPaths.10 = EXT:october/Resources/Private/Layouts
partialsRootPaths.10 = EXT:october/Resources/Private/Partials
}
setup.ts
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:october/Configuration/TypoScript/Configuration/" extensions="setupts">
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:october/Configuration/TypoScript/Library/" extensions="setupts">
constants.ts
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:october/Configuration/TypoScript/Configuration/" extensions="constantsts">
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:october/Configuration/TypoScript/Library/" extensions="constantsts">
Layouts/Default.html
<div style="background-color:red">
<f:render section="Default"/>
</div>
Templates/Default.html I put a simple sentence
Mon premier Template FLUID
Then I activate this extension.
And I include the new extension in Typo3 Template->Include october.
But the template doesn't display.
Where is the mistake ? What did I miss?
I noticed the URL you are refering to /TypoScript/ when your structure says [...]/Typoscript/ with a small letter S.
Some servers are actually pretty strict in the way of using captials. For example, a directory called HTML will be seen totally different as a directory called Html and HTmL.
I have this in config.toml:
baseURL = "https://my-username.github.io/blog/"
and there is a static file at static/img/foo.png.
Now, in content/posts/bar.md, I have the following content:
---
title: "Bar"
---
![foo](img/foo.png)
The picture isn't showing after I started the hugo server, so I inspected elements, and found out that Hugo generated the following URL for it:
http://localhost:1313/blog/posts/bar/img/hireme.png
This is not what I expect; it should be
http://localhost:1313/blog/img/hireme.png
When I use ![foo](/blog/img/foo.png), the picture is displayed correctly, but this is quite strange: /blog/ is part of baseURL, why do I need to type it again?
I think you should use <base> tag to make baseURL for static files.
Add the <base> tag into <head>:
<base href="{{ .Site.BaseURL }}">
And then you can insert image in post like this:
![Foo image](img/foo.jpg)
References:
https://www.w3schools.com/tags/tag_base.asp
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
In a simple setup where your site lives in the domain's root, a absolute reference to the image would be a standard practice. However, in your case where the site is nested, a more crafty solution is necessary.
I suggest using a shortcode to solve your dilemma. Just simply create a shortcode that takes in a resource file path and spits out the desired absolute path every time. The advantage to this approach is flexibility for future resource relocation to a cdn for example.
Your markdown code will be something like this:
![foo]({{< resource url="img/foo.png" >}})
Your shortcode template will be something like this:
{{ .Site.BaseURL }}{{ .Get "url" }}
Create a file named 'resource.html' in 'layouts/shortcodes/' folder, and drop in the shortcode template code above.
So when you decide you want to switch to a cdn you could easily do this:
://cdn.example.com/{{ .Get "url" }}
I am programming a website powered by Django 1.6.3. Under news you always see a big story and on the side recent articles. Therefore, I used Bootstrap 3 and wrote a static html page serving my requirements.
Now I would like to program the logic behind this. I save all my files under static that consists of the folders css, fonts (from Bootstrap), img and js. The image folder has some subfolder e.g. news. To create a new entry on the news page I would like to open the admin page, add a news_entry and select one image that should be under the titel. How is it possible to include the image in the page? My approach was:
<img src="{% static {{ news.image_name }} %}" class="img-title">
Unfortunately I get an parsing error. Image_name is a property of my news model.
You need to access the url attribute of your image_name.
Try:
<img src="{{ news.image_name.url }}" class="img-title">
Similar question here.
I'm attempting to change the of the Lightword theme to show only the page title in the tag, and not the "Page Title | Blog Title" it normally does.
In the header template, I changed the title line to:
<title><?php wp_title(''); ?></title>
After refreshing the page on the server, it STILL showed up as "Page Title | Blog Title". I went on to delete the title entirely as a test, leaving only <title></title> - but it appears something overrode it within WP, and the same title format came out.
Finally, I added a space in the title tag like such (designed to break any regexps):
<title><?php wp_title(''); ?></ title>
And at long last, my title actually came out <title>Page Title</ title>. This behavior strikes me as extraordinarily odd, however - why does wordpress (or this theme) resist changing the title structure? Is there any less-hacky way to get around it?
Try this instead to show just the page title:
<?php the_title(); ?>
EDIT
Try this code to get just the page name in title:
<title><?php wp_title("",true); ?></title>