Using Netlify CMS with Hugo - creating content of Academic Hugo theme - gallery

I'm trying to integrate Netlify CMS to Academic Hugo theme. I want to build a config.yml with a collection for post, talks and so on. My question is similar to this one. I was able to configure some of the fields of each post but I was not able to include variables enclosed in []:
+++
title = "Academic: the website designer for Hugo"
date = 2016-04-20T00:00:00
lastmod = 2018-01-13T00:00:00
draft = false
tags = ["academic"]
summary = "Create a beautifully simple website or blog in under 10 minutes."
[header]
image = "headers/getting-started.png"
caption = "Image credit: [**Academic**](https://github.com/gcushen/hugo-
academic/)"
[[gallery_item]]
album = "1"
image = "https://raw.githubusercontent.com/gcushen/hugo-
academic/master/images/theme-default.png"
caption = "Default"
+++
Please, any config.yml can output this kind of md?
Thanks a lot for your help!
UPDATED:
At the end I was able to do it and this is other case where I had issues:
+++
# About/Biography widget.
widget = "about"
active = true
date = 2016-04-20T00:00:00
# Order that this section will appear in.
weight = 5
# List your academic interests.
[interests]
interests = [
"Artificial Intelligence",
"Computational Linguistics",
"Information Retrieval"
]
# List your qualifications (such as academic degrees).
[[education.courses]]
course = "PhD in Artificial Intelligence"
institution = "Stanford University"
year = 2012
[[education.courses]]
course = "MEng in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2009
[[education.courses]]
course = "BSc in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2008
+++
Here the solution if it could help someone:
- file: "content/home/about.md"
label: "About"
name: "about"
fields:
- {label: "Widget (Don't modify)", name: "widget", widget: "string", default: "about"}
- {label: "Active", name: "active", widget: "boolean", default: true }
- {label: "Date", name: "date", widget: "datetime" }
- {label: "Weight", name: weight, default: 5}
- {label: "Interests", name: interests, widget: object, fields: [
{label: "Interests list", name: "interests", widget: "list",
default: ["Artificial Intelligence"]}]}
- {label: "Education", name: "education", widget: "object", fields: [
{label: "courses", name: "courses", widget: "list", fields: [
{label: Course, name: course , widget: string},
{label: Institution, name: institution, widget: string},
{label: Year, name: year, default: 2010}]}]}
- { label: "Body", name: "body", widget: "markdown", required: false }
Thanks a lot!

For nested fields, you will use either the list or object widgets.
For "header", you would use the Netlify CMS object widget, and for "gallery_item" you would use the list widget.
Example:
- label: "Header Settings"
name: "header"
widget: "object"
fields:
- {label: "Image", name: "image", widget: "image"}
- {label: "Caption", name: "caption", widget: "markdown"}

Related

Why do I have two different product ids on the same product in my data Layer?

I have a problem with product ids values on my data layer. When I checked Purchase data layer I could see ecommerce data layer section that looks like bellow:
ecommerce: {
currencyCode: "EUR",
purchase: {
actionField: {
id: "394299",
affiliation: "",
revenue: 0,
tax: 0,
shipping: 0,
coupon: "test999"
},
products: [
{
id: 296,
name: "Test Name",
sku: "STR99",
category: "Housewarming",
price: 0,
stocklevel: null,
quantity: 1
},
{
id: 393,
name: "Test Name2",
sku: "MN61",
category: "Wedding",
price: 0,
stocklevel: null,
quantity: 1
}
]
}
}
}
So I see that Test Name's ID equal to 296 and Test Name2 id equal to 393. But when I am on a product page for example on Test Name product page in data Layer I see that value of ecomm_prodid key equals to 484.
I compare it to ID that I could find in Woocomerce admin panel and it looks like the ID from ecomm_prodid key is valid. So the question is why am I seeing different value in Purchase data layer. And on Purchase I don't have valid one and unvalid. I only have one that i unvalid. Data Layer is implemented by wordpress plugins.

Custom metric/dimension not visible in GA4 DebugView on item/product-list level

We're trying to configure GA4 to gather same data that we have in UA.
The problem is that we cant see custom metrics data on item-level in DebugView.
In TagAssistant we can see that data is sent:
{
event: "purchase",
gtm: {uniqueEventId: 10, start: 1651XXX},
gtag: {
targets: {
G-XXX: {_ee: true, _uei: 3, _upi: 2},
UA-XXX: {
currency: "PLN",
country: "PL",
custom_map: {
dimension2: "referrer",
...
dimension13: "ecomm_totalvalue",
metric1: "metric1",
...
metric5: "metric5"
},
_uei: 4
},
AW-106XXX: {}
}
},
eventModel: {
transaction_id: "40XXX",
affiliation: "XXX",
value: "9.99",
currency: "PLN",
tax: "1.87",
shipping: "0",
coupon: "",
items: [
{
id: "670",
name: "Tusz Zamiennik T0711 do Epson (C13T07114010) (Czarny)",
brand: "XXX",
category: "Wkłady/Atramentowe/Zamienniki/Tusze/XXX -> Do:E" +
"pson",
quantity: 1,
price: "9.99",
coupon: "",
metric1: "9.99",
metric2: "9.99",
metric3: "9.99",
metric4: "9.99",
metric5: "9.99"
}
],
send_to: ""
}
}
However, on DebugView side we can see purchase event that:
contains all orginal parameters on event level (like transaction_id, shipping etc.)
contains all orginal parameters on item level (like item_id, quantity, etc.)
But our custom metrics are missing
In the other hand, we tried (with different event) push some custom-dumension data and:
they are visible on GA4 DebugView
we can create custom dimension in GA4 basing on this data and it works
I am thinking about:
Creating event-level custom metric to test if it will be passed to GA4 DebugView
Creating item-level custom dimension to test if it will be passed to GA4 DebugView
However, due to fact that GA requires 24h to make conclusions i decided to ask here for any sugestions why it is not working and what else may i test.

GA4 tracks value of purchase but doesn't add up to Total Revenue

As you can see GA4 clearly doesn't show revenue:
However, when I go to Configure-> Conversions I can clearly see that it does track the value:
Our data layer looks as followed:
{
event: "purchase",
gtm: {uniqueEventId: 7, start: 1541254301557},
ecommerce: {
transaction_id: "TEST000000184",
affiliation: "Brand Name B2C - Brand Name B2C website - Brand Name English",
value: "36.0000",
coupon: "",
tax: "4.5100",
shipping: "10.0000",
items: [
{
item_name: "Plate 27cm green",
item_id: "10000",
item_price: "5.37",
item_brand: "Brand Name",
item_category: "",
quantity: "4.0000"
}
]
}
Currency is a required parameter in your ecommerce object.
currency: "USD",
Also, you should keep your quantity as integers not floats
quantity: "4" not quantity: "4.0000"

Google Places API language=en returns results in other languages

I'm sending the request like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?&key=ENTER_YOUR_KEY_HERE&name=&types=restaurant&location=35.79067650569248,107.49634109437466&radius=521711.0&language=en
The query is in China.
and i'm getting results like this:
results: [
{
geometry: {
location: {
lat: 35.737293,
lng: 107.646029
}
},
icon: "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
id: "759bdf36fa8d5182c6cecb8839d21f5db691ab04",
name: "海底捞火锅西峰店",
place_id: "ChIJwQHr9-k9ZjYRkNpSDzYpfTo",
reference: "CnRrAAAAkM6HlYVwL2mO2sefdojOY7cqX9lQtA_OWt2pFzyGW7p6lj-1oSqFnX3q7_iJtDBGIcoRhqMxriUEXCD4Y8QaBZXhX_7IiqgO_2xHYHN9nWEKOYuPWmuj1V5nTy-D_w-im2OcZVoblKayGDuo2xJTiBIQ2DySEk1zgG1UDKHFnzBxTRoUqsR3fT9UOHrRwOj-hQZZygqxiWo",
scope: "GOOGLE",
types: [
"restaurant",
"food",
"point_of_interest",
"establishment"
],
vicinity: "Xifeng, Qingyang"
},
the name is in Chinese. is there something i can do?
MrUpsidown in the comments is correct: there's no English name for this place in Google's database, so returning the Chinese name Google does have is the best the Places API can do here.

meteorJS autoforms: Change a value before insert OR use multiple types of value

I use autoforms for my forms. Now I have a special problem and I am asking myself if its possible to solve this easy with autoforms.
With my autoforms I want to build a easy Category-Tree in my MongoDB. Just with a name and a parent (select).
This looks like this:
Categories.attachSchema(new SimpleSchema({
name : {
type: String,
label: "Name",
max: 200
},
parent : {
type : String,
allowedValues: [false, 'id_of_cat_1', 'id_of_cat_2', 'id_of_cat_3'],
optional : true,
autoform: {
options: [
{label: '- none -', value: false},
{label: 'cat 1', value: 'id_of_cat_1'},
{label: 'cat 2', value: 'id_of_cat_2'},
{label: 'cat 3', value: 'id_of_cat_3'}
]
}
}
}));
Very short and very simple. The autoforms now creates me the form and I am able to do stuff with it.
But whats the problem here ? The problem is the parent-value. Its type is String and because of this selecting "- none -" is not possible. But I want that the field parent in the database has a boolean value (false) when no parent is given.
The question is now how to solve this.
Is it better - and possible - to give a value 2 or more types ? If not it must be necessery to overwrite the value after or before isnerting to the collection - but this also does not work because the simpleSchema do deny this process. FOr overwriting I use matb33:collection-hooks.
You can use empty string instead:
parent : {
type : String,
allowedValues: ['', 'id_of_cat_1', 'id_of_cat_2', 'id_of_cat_3'],
optional : true,
autoform: {
options: [
{label: '- none -', value: ''},
{label: 'cat 1', value: 'id_of_cat_1'},
{label: 'cat 2', value: 'id_of_cat_2'},
{label: 'cat 3', value: 'id_of_cat_3'}
]
}
}
It makes sense since the empty string works as false in the if statement

Resources