Hugo content not rendering - hugo

I've used the hugo-icon single page theme to build a static site and have been asked to add a new page for product descriptions. I have read many tutorials/answers on stack and watched Mike Danes videos to date but cannot get a new page to render.
When I run the following command hugo new products/product1/_index.md a url to product1 is generated but no content is rendered. This is the content of my _index.md file;
---
title: "Product1"
date: 2021-05-24T14:47:36+01:00
draft: false
---
product1 info
I expect one of 2 things; To see 'product1 info' rendered at the url. OR I place a html file of the same name somewhere in the folder structure to render text etc. I have tried multiple locations to place html and still I cannot see anything.
Can someone explain or give an example of adding a new page to the hugo-icon theme and explain if I am missing a fundamental concept.
config:
# Main config file for icon theme.
theme = ["hugo-icon"]
baseURL = "https://www.example.com/"
languageCode = "en-ie"
title = "my site"
[params]
author = "Me"
description = "My site"
# Hero section (from here on is for icon theme)
[params.hero]
img = "images/hero_bg_green.jpg"
title = "My Site"
Thanks

I was missing this fundamental design pattern. Each folder created under layouts required a template. In my case this looked like the following where each page was designed inside the single.html file
Layouts
page1
single.html
page2
single.html
The route needs defining in the content folder inside content/pages/page-one.md like so where type is mapped to the folder name by its type definition
type : "page1"
title: "Page 1"
date: 2021-05-27T11:16:39+01:00
draft: false
My url therefore is www.example.com/pages/page-one.html which is designed in layouts/page1/single.html and mapped via the type definition to www.example.com/content/pages/page-one.md
The .md file inside content/... dictates the path to the url. The type definition dictates which page to render from layouts/...

Related

Remove SonataAdmin logo

I am trying to remove SonataAdmin logo. I don't want any picture. Every param that I put in my .yml file I get a broken picture icon on my admin view.
I have checked the conifguration and there is no wirtten documentation of how to hide logo.
sonata_admin:
templates:
user_block: '#AdminTemplates/user_block.html.twig'
title: My App
title_logo: /bundles/sonataadmin/logo_title.png //-- this part
Put your logo file here
src/AppBundle/Resources/public/images/your_logo.png
install asset :
$ php bin/console assets:install
And I think you have just to delete the first slash / in the title_logo :
# app/config/config.yml
sonata_admin:
templates:
user_block: '#AdminTemplates/user_block.html.twig'
title: My App
title_logo: bundles/app/images/your_logo.png //-- this part
The point here is to make a transparent image , so you can't see the logo, otherwise , there is no way to do it .

How to change Hugo's post image

I want to change hugo's post image.
+++
title = "how to read the book"
draft = false
date = "2017-01-25T21:39:26-06:00"
image = "book.jpg"
+++
Hello World. New Book Review.
I put book.jpg under mywebsite/static/images/ directory. But the post still using the default image.
Any suggestions?
I solved this issue by changing image = "book.jpg" to thumbnail = "images/book.jpg"
I followed the official guide from https://gohugo.io/overview/quickstart/ originally. It is very confusing.
If you're using front matter to configure your posts, follow these steps:
In your config.yaml file, make sure the cover parameters are set to not hide images
cover:
hidden: false # hide everywhere but not in structured data
hiddenInList: false # hide on list pages and home
hiddenInSingle: false # hide on single page
Add the image to the static folder (ex. meteor.png)
In your post's front matter, add the following lines to reference the image
---
title: "Impact Fanatics"
date: 2022-09-27T18:03:38-04:00
draft: false
relative: true
cover:
image: /meteor.png
---

Adding emoji to a Hugo page variable

How to add an emoji to a Hugo page variable? E.g. inside the title in the following code snippet:
date = "2016-11-20T12:00:00"
draft = false
tags = ["Fun"]
title = "Went sporting :heart:"
Hugo has two ways of handling Emojis.
Setting enableEmoji=true in your site config will handle emoji syntax like :heart: in your markdown content.
For titles etc. you must use the emojify template func, so in your template:
{{ .Title | emojify }}

how can I load a joomla module as a link?

this is my problem...
I have some of images and links that I want to load different joomla modules when user click on them.
mean each hyperlink can load another module|position
thanks all
In case that you just want to call a module's content from a url the following answer will help you.
If you just want to show / hide a module in the same page you could use something similar to my previous answer: Joomla 3 Show different modules on same position depending on toggler
Joomla provides the functionality to call a specific file of the active template by adding the tmpl=FILENAME key/value to the url's query string.
All built-in templates have a component.php file if user wants to load the template with the component only. You could check the following link for more details: Adding print pop-up functionality to a component.
You could do something similar to only show the modules that you want to load.
You could copy the component.php to a new file (I have used custom.php) and added the following php code in the <body> ... </body> part.
<?php
$jinput = JFactory::getApplication()->input;
$selectedPosition = $jinput->getString("position", "");
$selectedModule = $jinput->getString("module", "");
$selectedModuleTitle = $jinput->getString("title");
if($selectedPosition !== "") {
$modules = JModuleHelper::getModules($selectedPosition);
foreach ($modules as $module) {
echo JModuleHelper::renderModule($module);
}
} elseif ($selectedModule !== "") {
$module = JModuleHelper::getModule($selectedModule, $selectedModuleTitle);
echo JModuleHelper::renderModule($module);
}
?>
So with a similar way as loadposition / loadmodule works you could call the new template file using:
index.php?tmpl=custom&position=MODULE_POSITION
or
index.php?tmpl=custom&module=MODULE_TYPE
or
index.php?tmpl=custom&module=MODULE_TYPE&title=MODULE_TITLE
Optionally if you want to load the module with a specific style, you could pass it to the second paramter of the renderModule method like:
echo JModuleHelper::renderModule($module, array("style" => "xhtml"));
Hope this helps

bread crumbs for views drupal 7

Am working with views and am wondering if there is a way to get the view to update the breadcrumb trail. When on my first view called homme the breadcrumbs are not updated it still just says "home >" as if it is still on the homepage. When I click a post the breadcrumbs update to "Home › Blogs › admin's blog › ". I need it to say Home > Homme > Name of Article, basically what you would expect when going to a blog site or post.
Can I get the view to act like a blog?
One option is to try overriding the themeable output generated by the default breadcrumb function.
Assuming you've created your own theme - create a file called template.php at the root of your theme. Create a function named YOURTHEME_breadcrumb, where YOURTHEME is the name of the theme. The HTML returned by this function will be the breadcrumb. Modify the return values as necessary here to get what you want. Consider using Drupal's menu functions to build a more satisfactory breadcrumb.
Check the comments of this API article for more detail: http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_breadcrumb/7
Adding this to your template.php file should work with d7 sites:
function theme_breadcrumb($breadcrumb)
{
if (substr($_GET['q'], 0, 13) == 'news/category') {
$breadcrumb[] = l('News', 'news/');
}
if (count($breadcrumb) > 1) {
if ($breadcrumb) {
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) ."</div>\n";
}
}
}

Resources