Why is the Signature section of my Haddock generated documentation home page empty? - haddock

I'm generating documentation for my Haskell library using:
stack haddock --no-haddock-deps
And the resultant index.html page has an empty Signatures section.
Why is the Signatures section empty?

Thanks to the comment from #sjakobi, I now understand that the Signatures section is populated with a module's Backpack signatures, which my module lacks. So, I shouldn't expect any content in that section.

Related

TOC not displaying in Blogdown post (Hugo theme Even)

I have added a new post to my site made using blogdown. Despite the presence of toc: yes in my YAML, the table of contents is not displaying on the rendered webpage. I've also tried adding:
output:
blogdown::html_page:
toc: yes
which doesn't solve the problem either. I'm currently using the Even theme (Hugo), and in the .config file, I also have toc: yes present.
I checked out this post, but I wasn't able to find the files they are referencing, nor those particular lines of code. Also my issue is with new posts, not the home page.
Does anyone know what the problem might be?
EDIT: I can see in my index.html file (generated from index.Rmd) that the code for a toc is present. For some reason, it's not being rendered on the page?
TL;DR Solution: to get the table of contents to show in the Even theme, your posts must render to the .markdown format instead of .html format. In order to make this happen, you simple use the .Rmarkdown file extension when creating the post instead of .Rmd. Now, when you use blogdown::serve_site(), your post will use the output format .markdown instead of .html. Your post will now render with a beautiful table of contents.
A note for latex math mode users: when typing in your .Rmarkdown document, you will now have to escape your $'s and \'s. So for example, $\le 0.2$
will have to be typed as \$\\le 0.2\$.
I hope this overly elaborate problem and solution is helpful to someone!
I figured out a workaround for this.
First, I'm not sure how to provide a reproducible example in this context, but I can say that if you open an RStudio project, run blogdown::new_site(theme = "olOwOlo/hugo-theme-even"), add a New Post using the Addin dropdown menu, add some headings to your post, make toc:true, use Serve Site from the Addin menu. You will see your post working fine in every respect - only it will be missing the table of contents.
Workaround:
I don't know why, but it appears that the table of contents will show if I keep a copy of the post in .md format, and delete the .html document. The default behavior seems to use the .html document if it is present; failing that, it will use the .md document.
To keep a copy of the post in .md format, use the following code in the YAML of your .Rmd document:
output:
blogdown::html_page:
keep_md: yes
Serve the site, delete the .html document (but keep the .md document), and the table of contents appears in all of its glory (you may have to actually knit the file to get the .md).
I don't know why this works...I've seen elsewhere (although I can't seem to find the post again) that some hugo themes don't play nicely with .html files, and prefer .md files, and that appears to be the case for the Even theme.
In sum: My workaround for now is thus to work on my posts, and when I'm done, knit the document with the option above, delete the .html file, and be on my way.
Caveat: blogdown seems to automatically re-render all the old posts when using Serve Site. According to this stack answer, Serve Site should only render documents that have undergone changes. Regardless, the old posts are most definitely being re-rendered, even when working on an unrelated post. I'm not sure if this behavior is attributable to blogdown per se, or the RStudio project.
I tried going to Tools -> Project Options -> Build Tools, and unchecking the boxes "Preview site when building", yet the behavior persists. Which means I will have to continuously delete these new .html files for all old posts every time a I make a change to any other file. Currently I only have one post, so not a big deal...yet.
If someone knows of a solution to this caveat, I would be extremely grateful. If I find one, I will edit this question and add it.
EDIT: it appears that blogdown will re-render the old post if there is no .html document present. Otherwise, it does not re-render it.
EDIT 2: Aha! According to the answer to this question, simply changing the file extension of the blog post from .Rmd to .Rmarkdown will produce a .markdown document instead of a .html document.

How do I get my blogdown blog on R-Bloggers?

I generate my blog using blogdown, but when I have tried to submit it to R-Bloggers it is not accepted because my feed returns the following error:
This XML document is invalid, likely due to invalid characters.
XML error: Undeclared entity error at line 6, column 35
Apparently the feed for my website does not contain the full RSS content. How do I get it to hold all the content?
In the Hugo documentation (https://gohugo.io/templates/rss/), they provide the embedded RSS xml file that currently "ships with" Hugo. According to the docs, a section’s RSS will be rendered at /SECTION/index.xml (e.g., http://spf13.com/project/index.xml). So for your posts, it would be http://spf13.com/post/index.xml.
The key line in the built-in RSS xml file is this one:
<description>{{ .Summary | html }}</description>
From this discussion (https://discourse.gohugo.io/t/full-text-rss-feed/8368/2), it looks like you want to change what goes in the description tags from .Summary to .Content. Here is an example blog post where the author implemented this change: https://randomgeekery.org/2017/09/15/full-content-hugo-feeds/
So you would change that one line in the Hugo RSS xml to:
<description>{{ .Content | html }}</description>
The full rss.xml file should live in your layouts/ folder, with that one line changed.
It does look like there are other options you could test, like working with output formats in your config.toml file (https://github.com/gcushen/hugo-academic/issues/346; https://gohugo.io/templates/output-formats/) and referencing your RSS in your header.html (https://gohugo.io/templates/rss/), but changing .Summary to .Content should address your issue.
This seemed to work for me...
create a directory in your layouts folder called tags. So you should have this folder structure:
<your_base_directory>/layouts/tags
(this isn't the layouts directory in the themes directory).
Then create a new file:
<your_base_directory>/layouts/tags/rss.xml
Then paste this into your newly created rss.xml

Twig include content and check if already include

I have read the changelog of the twig (1.15.0 (2013-12-06))
https://github.com/fabpot/Twig/blob/master/CHANGELOG
* added a source function to include the content of a template without rendering it
But How can I do it? And what does it do exactly?
there is a function to check if a twig has already been included?
thanks !
The changelog refers to Twig's new include function, as opposed to the include tag.
There's some examples in the documentation (click the links above), and also some usage examples in slide 19-21 of this presentation.
When the changelog says "without rendering it", it means it isn't immediately output to the response stream, which enables you to catch and filter the contents before outputting/printing them.

How can we save multimedia components using external resource types if the URL doesn’t end in with a file extension?

We have a Tridion use case related to curated content where we are creating multimedia components for images associated with our content which are pointing to External resource types instead of uploaded resource types.
One of the issues we have run into with this use case is that despite explicitly setting the Multimedia Type for the resource, if the URL of the image has either a query string in it: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default or uses a ‘friendly url’: http://www.somewhere.com/images/myimage/ when we save the component, Tridion barfs with error messages similar to : ‘Invalid value for property 'Filename'. Unexpected file extension: jpg?w=160&h=120&mode=crop&404=default. Expecting: jpg,jpeg,jpe.’
So far, the only way we’ve been able to figure out to potentially get around this issue is to do something hacky like appending an extra query string parameter to the very end of the urls which end with the expected file extension: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default&ext=.jpg Obviously, this is not the best solution and in fact may not work for some images if the site they are being served from strictly validates the requested URL.
Does anyone have any ideas on how we can work around this issue?
Unfortunately I can't really think of an easy solution to this, since Tridion "detects" the Mime type by checking the file extension.
You could perhaps add it while saving and remove it when reading (via Event System)? Definitely a worthwhile enhancement request, to my knowledge this behavior has not been changed for the soon-coming Tridion 2013... See comment below, it has been changed for 2013.
+1 for Nuno's answer. Recognizing that the title of your question is specific to multimedia components, you may want to consider another approach which is to use normal Components, not Multimedia Components. You can create a normal component schema called something like "External Image" that has an External Url field to store your extentionless url.
Content authors will then include these images via regular component linking mechanisms in the Tridion GUI.
You will then need a custom link resolver TBB that will parse the Output item (via Regex) looking for any Tridion anchor tags <a tridion:href="tcm:x-y-z"> and for each one replace them with an <img src=...> tag where the src path would come from this linked component.
For an example of a similar approach, but with videos, and sample code for a custom link resolver TBB have a look at the code in the following post: http://www.tridiondeveloper.com/integration-sdl-tridion-jw-media-player.

How to get objects in a razor template in Tridion?

I am writing a common Razor TBB, which will use in Component Template and Page template as per my requirement.
So that, I need a Page and Component object in the razor TBB according to applying TBB on Page Template and component Template
My requirement to display/use the metadata field values from Page/Component in specific area of the page.
That's why, i want to access metadata values by the object but unable to get the object,
Please also follow-up my comments with Frank.
Can any one suggest me?
Did you have a look at the (remarkably helpful) documentation that is available for the Razor mediator?
http://code.google.com/p/razor-mediator-4-tridion/
http://code.google.com/p/razor-mediator-4-tridion/downloads/detail?name=RazorMediatorDocumentation_v1.2.docx
These are full of examples that access the current Component and the Page. Just my 10 second search gives these fragments:
<body class=”#Page.Metadata.BodyClass”>
<div class=”#Component.Fields.NewsStyle”>
<img src=”#Fields.HeaderImage.ID” alt=”#Fields.HeaderImage.AltText” />
Edit: I see you added some more details in your follow-up comment. You might want to do as Bart suggests and add those details to the question. In the meantime, I'll spend a few more minutes searching the documentation for you.
The official documentation (the Word document I linked above), contains this example that seems to process metadata:
#foreach (var keyword in Publication.MetaData.SomeKeywordFields) {
<li>#keyword.Title (#keyword.Id)</li>
}
The output of the Razor template will become the Output item in the Package. So it doesn't make any sense to use a Razor mediator to process the Output item. For that you might as well use a regular C# (fragment or assembly) TBB.
Another edit: It seems that the Razor mediator's implicit Fields variable always maps to the Component fields and the Metadata variable always maps to the Component's meatadata fields. I've linked the above names to the relevant fragments on Google code for your convenience.
So you seem to have two options:
detect whether you are in Page or Component (e.g. by looking at whether the implicit Page variable is null or not) and then have conditional expressions everywhere (isInPage ? Page.Metadata : Metadata)
fix this limitation of the Razor mediator code yourself or hire someone to fix it for you

Resources