Overwrite Metatag for an automatic generated page - drupal-7

I have the Metatag module in drupal 7.4 and it uses the title of the page for the Metatag. However there is one page in particular where the client wants another Metatag, this page is a generated page so I can't adjust it in the backend (with the module). My question is, is there any kind of way where i can adjust this meta tag? Jquery or in template.php with a check on pagetitle?
Greetings.

Related

Drupal 9 - Two different URL's work for same page

I have a Drupal 9.x version site, as an example whose page URL is like : http://www.example.com/general
but we need that URL to be work as http://www.example.com/something/general also.
It means, my every page of my site to be work (both URL's) with or without PRE-FIX word before of every page name.
Reason: I am looking this feature is, my website page has to load into other website pages. Which means with an iframe I am planning to display the drupal 9.x content into other website. With this PREFIX word if we are calling the URL the header, footer, sidebar of the present page site will be hidden.
If with out the PREFIX word if i am looking the website, the header, footer, sidebar will be displayed normally.
Both URLs should work:
I have about 550+ content pages, and many of our content pages are coming from custom modules, views.
I tried with URL alias, If i have go with this then I have to add these all 550+ content pages URL in our URL alias, that will not work for me.
Is there any other way around that i can achieve the same with minimum effort.
Please suggest me the solution, It will be very helpful for me.

Django CMS only one entry in model

I want to make a persistent floating(using CSS) contact button on every page in Django CMS.
I need to get the first item in DB and construct the URL according to it in the template.
Also, the place holder should display first item and allow editing it everywhere if possible.
Or maybe not have an input at all and allow editing the contact info in the admin.
Or have an option to use the first one which is default or a different number for a particular page.
I have currently made my plugin but it creates a new entry every time.
If you want something to appear on every page you need to make use of static_placeholder (docs) which acts like a normal placeholder but you only need to add plugins to it on one page for them to appear in every page which you include the static_placeholder of the same name.
For example I often have a footer which includes a menu & allows a client to add their own content like contact address, phone number etc. The easiest example of how you could do this would be to include the following template tag in your base.html so that it gets included in all pages inheriting your base template.
{% static_placeholder "footer" site %}
Also the standard placeholder tag doesn't work in apps, so if you include apps in your CMS site via app hooks you can also include the static_placeholder in the app templates to add plugins.

dnn - 2sxc - modules of a duplicated page / page template are using the same content

I created a page within dnn (v9.0.2, 2sxc 8.12.0) with all modules (only 2sxc content modules) like the page design had defined it. After this I created a template from this page. After this I created a couple of sites using this template.
My problem is, if I change the content of module A on page 1 - all modules A on the other pages 2..n of this template have this content now too. Same effect, if I use the duplicate functionality.
Does anyone have a hint how to use page temlating using 2sxc content modules?
What you need to do is open the template file in an editor and locate the section that describes the module. The best way to do this is to find the EntityId of the content item on the page from which you created the template. Then, find that number string in the template. Just remove the string, leaving the XML node otherwise intact.
When you build the page, you'll get a 2sxc module that is uninitialized and you'll need to specify the content.
If anyone is listening, I wish that this behavior was different. I'd prefer that the template assigned to the module could be preserved, but with the default content showing.
Basically the issue is that DNN has only one way to export a page, and we would need something where our code could contribute something before the export is complete.
At the moment there are two ways to do this.
One way is to use the method described by Joe, modifying the XML export
The other way is to place un-initialized blocks on the template page - meaning that you select your content-type / template, or your app, but don't start adding any content yet. This should result in the identical XML as the one modified manually.

How to modify HTMLElement in index.html before page gets returned to requestor

Based on my custom URL parameters I process, I am trying to modify dynamically a meta tag I have id'ed in index.html like so:
<meta name="og:image" content="http://example.com/someurl.jpg" id="ogImage"/>
The code below in my home.ts seems to be working
document.getElementById('ogImage').setAttribute("content", Media.ImageURL) ;
I can verify it is via the browser dev console/elements.
However, when I view from facebook via their ojbect graph debugger at
https://developers.facebook.com/tools/debug/og/object/
It appears to see the default
http://example.com/someurl.jpg
as if the index.html is shipped before my home.ts gets chance to make the update.
Perhaps, my understanding is flawed and there is better way to do this.
Thank you.
Note1: initially, I was thinking I had to make some angular binding between index.html and one of my services but I could not locate any sample code, the closest I came to was this post
How can I update meta tags in AngularJS?
But I don't know how to apply it for my ionic2/3 code, so I opted for the document.get approach.
Note2: the ultimate goal here is to share a link into a social media (web or app) like facebook, a messenger like viber/skype, etc... and have it resolve to meaningful images, title, description to drive the visit back to the site via browser, or app if the user clicking on the link is on a mobile device with my app version of the site installed on his device.
Note3: if you decide to point me to ionic deeplinking please provide code to match above, because I could not understand how to apply to my case.
If you are trying to implement dynamic open graph meta tags values in your pages, you will need a server-side scripting language like php. Such a script will run on the server, update the pages as needed, then the pages will be served to the requesting site or application.
client-side scripting (ie. JavaScript) is usually ignored when a site or app is merely visiting your site/link for the purpose of extracting (aka scrapping, parsing html) information such as the one provided by the open graph meta tags (og:title, og:description og:image...).

Creating an index page automatically

I'd like to have dotnetnuke build an index page based on pages that have a particular tabid. Are there any modules that do this already?
e.g. we create multiple pages under /News and then the index page lists links to all the news articles. Would be handy if we could also enter our own HTML text (maybe on the News article page itself) that is then displayed next to each link on the index page.
Thanks!
By default, there are no 'real' pages in DNN. Everything is served up in the Default.aspx from content that is stored in the database.
What you could do is create a module that populates data based on the TabId or Path. Then, there is a setting in DNN to make a module appear on EVERY page. Since the module is on every page, it could populate its data based on the TabId or the path, or just not show anything if it doesn't match your criteria.
For something like that, I used a module called SQLGridSelectedView from www.tressleworks.ca (I have no affiliation) and I wrote my own SQL to fill in the fields, and I defined a custom layout (instead of the default data grid) so I was able to do something like what you are asking without code.
There is a module from Ventrian called Child Links that does what you are talking about. You can use it to grab title & description from the pages below a relative to a specific page to build out menus etc.
It allows for formatting however you want as well.

Resources