How can I use custom parameters in [permalinks] section in Hugo? - hugo

I am setting up the [permalinks] section of the config.toml in a Hugo website. I want to use more values than the ones provided here.
I've tried
[permalinks]
post = "/p/:year:month:day:hour:minute"
but it's throwing an error saying it's malformed probably because :hour and :minute aren't valid. I mainly wanted to use these two in the permalink

UPDATE: Hugo v0.60.0 has been released and with it (and later versions) you can use something like this to accomplish what you asked for:
[permalinks]
post = "/p/:year:month:day:15:04/"
In Go and Hugo, you can think of the reference datetime as:
01/02 15:04:05 2006 MST
This is why hour is :15 and minute is :04 in the permalink. Info about date and time in Go is at https://golang.org/pkg/time/.
Below is my original answer...
According to Notes release notes 0.60 · Issue #6490 · gohugoio/hugo · GitHub, this will be possible soon. Here's the relevant excerpt:
Permalink config an dates: 6489 [*]
I want this too!
[*] Support Go time format strings in permalinks by look · Pull Request #6489 · gohugoio/hugo · GitHub

Related

iam service account documentation discrepancy

There is a discrepancy between the documentation for an IAM V1 Service Account and the example shown in https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/master/examples/v2/project_creation/service-accounts.py.
The document shows that the properties has a 'name' field, with a value that looks like projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}. The other properties that can be set are 'displayName' and 'description'.
The example does not have the name and description properties, but instead has 'accountId' and 'projectId'.
I am confused as to which is the correct usage.
Ecample on Github is old : Latest commit 81378b1 on Mar 4, 2017 and the documentation was updated more recently: Last updated 2020-08-18 UTC which means that some of the field names have changed and example is not correct.
To correct this you may file an issue on Google's Issue Tracker.
Always use whatever is in the official documentation - it's the best source of reference if in doubt.

Azkaban runtime parameter for yesterday

According to official website, Azkaban only provides year-month-date for running time like:
${azkaban.flow.start.day}
Is it possible to add parameters for the day before?
You can define it with jexl by yourself.
e.g.
yesterday=$(new("org.joda.time.DateTime").minusDays(1).toString("yyyy-MM-dd"))
ref: https://github.com/azkaban/azkaban/pull/277

AngularJs: Error: A security problem occurred in IE11

We have developed a site using AngularJS 1.2.x version. The data to be displayed is got as a JSON and we have used angular expresions to populate these.
In the JSON response we have a URL in this format http://username#site.com. This is getting rendered properly in Chrome, FF. But in IE11 we are getting the following exception
Error: A security problem occurred.
at xa (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:124:230)
at Anonymous function (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:116:319)
at Anonymous function (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:116:319)
at Anonymous function (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:116:319)
at r (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:7:390)
at start (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:285:470)
at c (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:282:408)
at G (site/angularjs.d7ecc107a031818a8e5269a12c25ec8e.js:284:243)
at Anonymous
We found a similar question in(Angularjs with Internet Explorer 11, security issue) but the link provided in the accepted answer is no longer valid.
Is there any workaround to solve this issue?
I guess it's not possible, it's a security matter of IE and there's no workaround for that other than changing the url format to something IE accepts.
About the broken link, for some reason the english version of that article is not available anymore, but I've switched the locales in the url and managed to find other languages including pt-BR, pt-PT, es-ES and based on your profile hi-IN, if that doesn't work for you, you can try to Google Translate one of them to english or even try different lacale in the article url.
Those are the ones I tried and they're not broken:
Portuguese (Portugal) : pt-PT - https://support.microsoft.com/pt-pt/help/834489
Chinese (China) : zh-cn - https://support.microsoft.com/zh-cn/help/834489
Portuguese (Brazil): pt-BR - https://support.microsoft.com/pt-br/help/834489
Spanish (Spain): es-ES - https://support.microsoft.com/es-es/help/834489
Hindi (India): hi-IN - https://support.microsoft.com/hi-in/help/834489
Japanese (Japan): ja-jp - https://support.microsoft.com/ja-jp/help/834489
There ought to have more locales available but I'm not wiling to test all of them.

How to add a telephone link via wagtail?

I am trying to add links in the form 555-555-555 arbitrarily into paragraphs of text on my wagtail site. These phone numbers are currently peppered throughout the site as plain text, but I want to convert them to links.
I found this old wagtail github issue where they explained why they would not add them, but the 'Special-purpose pages' use case they described seems to be different than mine: my site has these numbers in paragraphs of text on most of the content pages (blog, product, marketing, etc).
Can anyone explain how I can add telephone links that can be used throughout the site?
I am using wagtail 1.x
To have telephone link within rich text, you'll need to create a plugin for Hallo.js. Have a look at the documentation and how Wagtail 1.13 creates and register such plugins.
Be aware though that it's usually quite involved and that Wagtail 2.0 rich text editor is now Draftail and Hallo.js is deprecated. Therefore, if you create a Hallo.js plugin and upgrade to Wagtail 2.0, you'll have to add some configuration to continue using Hallo.js or recreate the plugin for Draftail.
FWIW, if you are interested in having a look at what would be involved with creating an plugin for Draftail, you'll need to create an entity (also note that the API for creating entities should receive some enhancements in Wagtail 2.2).
With Raw HTML there is nothing to prevent editors from inserting malicious scripts into the page. Do not use this block. http://docs.wagtail.io/en/v2.1/topics/streamfield.html#rawhtmlblock
A workaround would be a custom filter. Eg:
{{ self.text|richtext|phonify }}
In your templatetags.py:
>>> def phonify(val):
... for tel in re.findall(r'tel:(\d+)', val):
... tag = '{}'.format(tel, tel)
... val = val.replace('tel:{}'.format(tel), tag)
... return val
...
>>> phonify('Hello tel:123 world tel:456!')
'Hello 123 world 456!'
>>>
Now you can instruct editors (via help_text) to add phone numbers like tel:5555555555.
This example does not handle - and +1. But if you figure that out, I'll update the answer ;)
I ended up chopping up my paragraphs and including raw html where I needed to add the tel links. A bit tedious, and the styles were slightly different on some pages, but shorter than doing it any other way.

What parameters are required to create an "Add to Google Calendar" link?

We can use this link to add a new event to Google Calendar by parameters
https://www.google.com/calendar/render?
action=TEMPLATE&
text=EventName&
dates=20131206T050000Z/20131208T060000Z
&location=EventLocation&
sprop=name:Name&
sprop=website:EventWebite&
details=EventDetail&
sf=true&
output=xml
But I can't find any documentation about these parameters.
Does anyone know where's it?
Explanation about the available parameters:
anchor address:
http://www.google.com/calendar/event?
This is the base of the address before the parameters below.
action:
action=TEMPLATE
A default required parameter.
src:
Example: src=default%40gmail.com
Format: src=text
This is not covered by Google help but is an optional parameter
in order to add an event to a shared calendar rather than a user's default.
text:
Example: text=Garden%20Waste%20Collection
Format: text=text
This is a required parameter giving the event title.
dates:
Example: dates=20090621T063000Z/20090621T080000Z
(i.e. an event on 21 June 2009 from 7.30am to 9.0am
British Summer Time (=GMT+1)).
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ
This required parameter gives the start and end dates and times
(in Greenwich Mean Time) for the event.
location:
Example: location=Home
Format: location=text
The obvious location field.
trp:
Example: trp=false
Format: trp=true/false
Show event as busy (true) or available (false)
sprop:
Example: sprop=http%3A%2F%2Fwww.me.org
Example: sprop=name:Home%20Page
Format: sprop=website and/or sprop=name:website_name
add:
Example: add=default%40gmail.com
Format: add=guest email addresses
details: (extra)
Example: details=Event%20multiline%0Adetails
Format: details=description text (google also accepts html in this text)
http://useroffline.blogspot.com/2009/06/making-google-calendar-link.html
The link from snoopy_15's answer points to an old Google URL that is currently being redirected to the new Google support page. This new page does not explain how to generate the kind of link asked in this question.
However, thanks to the wonders of Internet Archive: Wayback Machine, the older pages are still archived and available!
The latest available version is from March 2012, and it includes a form with a simple JavaScript code that still works! Sure, this is not an official documentation (and I'm still looking for one), and this is not even a documentation (it is an interactive form with a script), but it is the closest I could get.
These are the parameters that I use when I create these links. There are other parameters that exist, but I don't find them useful and they are optional. The details about how the dates work are particularly vexing and were never sufficiently documented by google.
action=TEMPLATE (required)
text (url encoded name of the event)
dates (ISO date format, startdate/enddate - must have both start and end time or it won't work. The start and end date can be the same if appropriate.)
to use the user's timezone: 20161208T160000/20161208T180000
to use global time, convert to UTC, then use 20131208T160000Z/20131208T180000Z
all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong. You must use the following date as the end date for a one day all day event, or +1 day to whatever you want the end date to be.
details (url encoded event description/details)
location (url encoded location of the event - make sure it's an address google maps can read easily)
You have one more param for specifying Guests
Add:
Example: add=default%40gmail.com
Format: add=guest email addresses
Demo
https://productforums.google.com/forum/#!topic/calendar/Ovj6BNTQNL0

Resources