Get the computed title in Nuxt 3 - nuxtjs3

The Nuxt configuration defines a default title and a titleTemplate.
I would like to access the computed title from a Nuxt page.
The configuration looks like this:
export default defineNuxtConfig({
app: {
head: {
title: "Default title",
titleTemplate: "%s - Company"
}
}
})
Within a page I would like to define the title of the page as follows:
useHead({
title: "Page title"
})
And just after access the computed title from the title template so in this case it would be Page title - Company.
And with this value I would like to define the og:title meta tag.
Do you know how to achieve this or a possible workaround even with a plugin?
The goal would be not to repeat things just to define the meta tags.

Related

Nuxt - define static meta tags per site without using SSR

Is it possible to define static meta data for each route in nuxt.config.js?
Suppose there is the following folder structure:
- pages
- examplepage.vue
- loremipsumpage.vue
- index.vue
the following is configured in nuxt.config.js:
head: {
title: 'Hi, I should only be displayed if nothing else is defined!',
meta: [
{ hid: 'description', name: 'description', content: 'Hi, I should only be displayed if nothing else is defined!' },
]
},
the following is configured in examplepage.vue:
head() {
return {
title: "Examplepage",
meta: [
{ hid: 'description', name: 'description', content: 'I wanna be placed in the generated html' },
]
}
},
And yes I know, that works in principle. When calling the page, the title and the meta tags are adjusted by the javascript. But not when generating my static examplepage/index.html file.
The following head is still generated there (dist/examplepage/index.html):
<head>
<title>Hi, I should only be displayed if nothing else is defined!</title>
<meta data-n-head="1" data-hid="description" name="description" content="Hi, I should only be displayed if nothing else is defined!">
.....
Is there a possibility to define fixed meta tags for certain routes which will be considered when generating the static html files? The data is not even dynamic. I only want to define static meta values for static routes.
Important notice:
I know that SSR would solve my problem.
But i would like to continue to run the site as SPA.
I have already tried various configurations in nuxt.config.js. However, all without success. In the Nuxt documentation I have also not found.

tinyMCE4 can't get external templates to work

I'm very new to tinyMCE (and to JavaScript), so I'm sorry if the answer to my question is obvious. (I'm also working on code and files that another developer created and that I'm not overly familiar with.)
I need to use an external template file for tinyMCE4, and I can't get it to work. I've looked at the tinyMCE4 documentation, but I don't understand where I'm going wrong.
The tinyMCE init is in an index.cfm file, and the list of templates is in a separate file, template_list.js.
Contents of template_list.js:
var tinyMCETemplateList = [
["Name", "templates/file1.cfm", "Name."],
["Name2", "templates/file2.cfm", "Name2."],
...
];
In index.cfm, I've included "template" in the plugins line.
To pull in the templates to appear as a list in a drop-down so the user can choose a template, I've tried:
template_external_list_url: "tinymce/js/tinymce/template_list.js"
With this, when I run the program and click the Insert Template button I get a "No templates defined" error.
I've also tried:
templates : [{url:"tinymce/js/tinymce/template_list.js"}]
With this, the Insert Template dialog box appears, but the drop-down is empty, and the raw code from template_list.js appears in the text area under the drop-down. I get the same result if I change the code in template_list.js to:
[
{title: "Name", url: "templates/file1.cfm", description: "Name."},
{title: "Name2", url: "templates/file2.cfm", description: "Name2."},
...
]
...and also if I add quotations around "title", "url", and "description".
Again, sorry if the answer is obvious, but as a beginner I appreciate any help.
Per the documentation the TinyMCE configuration object expects you to pass an array containing one object for each template. At a high level it would look like this:
tinymce.init({
selector: "textarea", // change this value according to your HTML
plugins: "template",
menubar: "insert",
toolbar: "template",
templates: [
{title: 'Item 1', description: 'Desc 1', content: 'My content'},
{title: 'Item 2', description: 'Desc 2', url: 'development.html'}
]
});
You will note that the templates configuration option is passed an array of objects - this is what TinyMCE expects so no matter what you have to return an array of objects.
You can insert the template HTML directly (as shown in the first example above) or you can point to a URL that the browser can fetch when TinyMCE is initialized (as shown in the second example above). There is no template_external_list_url configuration option so that is not working because its not valid.
If you want to externalize the templates outside the TinyMCE configuration you can place the data in a file and reference that via a URL. For example:
tinymce.init({
selector: "textarea", // change this value according to your HTML
plugins: "template",
menubar: "insert",
toolbar: "template",
templates: "/path/to/the/file/templates.php"
});
The URL referenced there must return an array of objects as that is ultimately what TinyMCE is expecting. Your example above seems to imply your external file is returning a JavaScript variable named tinyMCETemplateList - but that means nothing to TinyMCE so while the file may be loaded what is "returned" is not an array of JavaScript objects.
I would suggest you start by getting things to work without externalizing the templates (just make sure you get the basics working). Then externalize the content to a separate file and make sure that the file returns an array of objects. I would note that your example using tinyMCETemplateList seems to return an array of arrays which is not what TinyMCE is expecting.
I found this really frustrating and fiddly to get working at all. Eventually what I'm doing is calling a function in another js file that returns an array that I give to the templates parameter.
function GetTemplateArray()
{
return new Array(
{
title: "2 Columns",
url: "templates/template1.html",
description: "Adds a 2 column table"
},
{
title: "3 Columns",
url: "templates/scf/template2.html",
description: "Adds a 3 column table"
}
);
}
Then in the tinymce.init code:
tinymce.init(
{
...
templates: GetTemplateArray(),
...

alfresco search results : -> add parameter to search item url

I wanted to change the url of search result,
I found that this is an aikau page ,
The faceted-search page returns multiple results ,
If we click on search result item which is document then it's redirects us to document-details page ,
as shown in image the url /share/page/site/swsdp/document-details?nodeRef=workspace://SpacesStore/5fa74ad3-9b5b-461b-9df5-de407f1f4fe7 i wanted to add one parameter here
like this /share/page/site/swsdp/document-details?nodeRef=workspace://SpacesStore/5fa74ad3-9b5b-461b-9df5-de407f1f4fe7&searchTerm=web is there any way to add this parameter,
please help.
searchTerm=web
I have overrided aikau widget FCTSRCH_SEARCH_RESULT with my custom widget files by
var searchResultWidget = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULT");
if(searchResultWidget) {
searchResultWidget.name = "custom/alfresco/search/AlfSearchResult";
}
So my widget FCTSRCH_SEARCH_RESULT will be like this
{
id: "FCTSRCH_SEARCH_RESULT",
name: "custom/alfresco/search/AlfSearchResult",
config: {
enableContextMenu: false
}
}
and able to call my custom widget js file and changed the url.

How can you pass a Blaze Template to the Column Title in Aldeed:Tabular?

In the column I'm displaying YES/NO values as red/green Fontawsome icons. I'd like the column heading to also be the same icon, and not text work.
The aldeed:tabular allows Blaze templates to be passed when displaying a cells contents.... but is there a setting to pass Blaze template to the column title.
For cells the syntax is
{
tmpl: Meteor.isClient && Template.blazeTemplateName
}
but for the title setting it doesn't seem to handle templates..the docs only have an example with a string
{ title: 'columnNameToDisplay' }
And when you try setting the title to a blaze template you get
TypeError: col.sTitle.replace is not a function
which clearly means its expecting text and not a template.
Any ideas how to also change the title display to a blaze template.
Figured it out....you can pass HTML to the title.
{
title: '<i class="fa fa-globe fa-fw" aria-hidden="true"></i>',
}

How can I set the title dynamically per page with Manuel Schoebel's SEO package?

With Meteor 1.0.3.1 and Iron Router, I need to set the title dynamically for some pages, while defaulting to a certain title for other pages, using Manuel Schoebel's SEO package. How can I accomplish setting a dynamic page title for a certain route?
I've set SEO up generally like this:
Meteor.startup(->
[...]
SEO.config({
title: 'MusitechHub'
meta: {
'description': 'The hub for finding and publishing music technology projects'
}
})
undefined
)
As stated in the package README, you can use an iron:router onAfterAction hook to dynamically set the title to whatever computed value you want :
Router.route("/post/:slug", {
onAfterAction: function() {
var post = Posts.findOne({
slug: this.params.slug
});
SEO.set({
title: post.title
});
}
});

Resources