Should sitemap URLs include file extensions? - sitemap

I generated a sitemap with this tool: http://www.angeldigital.marketing/image-sitemap/
It spat out this code:
...
<url>
<loc>http://example.com/page</loc>
</url>
<url>
<loc>http://example.com/page.html</loc>
</url>
<url>
...
In my .htaccess file, I'm hiding .html, so example.com/page.html displays as example.com/page.
My question is, should the sitemap include both locations? If not, which one is preferable?

It looks like I should select a canonical url and include only that in the sitemap.
https://support.google.com/webmasters/answer/139066

Related

Is it possible to include external rst files in my documentation?

I'm building a documentation for a platform that includes modules. I would like to let the documentations live in these modules repositories and include them in the "master" doc with the include command.
I tried the following :
.. include:: https://github.com/12rambau/sepal_ui_template/blob/master/doc/en.rst
But nothing was added to the file
Is it possible to use absolute link in includecommand ?
My main objective is not to use the include command but to avoid code ducplication and use a file that is available on the web. based on #Steve piercy answer I came up with this solution :
In the conf.py file I copy the content of the file from github
be careful and use the raw.githubusercontent.com link to avoid importing html
# [...]
# -- Copy the modules documentation ------------------------------------------
from urllib.request import urlretrieve
urlretrieve (
"https://raw.githubusercontent.com/12rambau/sepal_ui_template/master/doc/en.rst",
"modules/sepal_ui_template.rst"
)
after that the file is created under modules/sepal_ui_template.rst in my documentation and I can safely access it.
It will be download again every time I rebuild my documentation.
No. A fully qualified URL is not relative to the document. According to the docs for the include directive:
The directive argument is the path to the file to be included, relative to the document containing the directive.
There are alternatives, including this one.

How to specify asciidoc to use local directory for stylesheet within the document?

I can make asciidoc use the local directory for the stylesheet by using the full path:
:stylesheet: /this/complicated/path/my.css
But I want to make my document both self-contained and movable. Is there a way to specify that I want it to use the file my.css from the same directory where the .adoc file is located?
If you do not specify a path, the stylesheet is assumed to be in the same directory as the document:
:stylesheet: my.css
See: https://asciidoctor.org/docs/user-manual/#applying-a-theme

Asciidoctor: How to add Google Analytics code to all HTML pages with asciidoctor-maven-plugin

How do I add Google Analytics (or Google Tag Manager) code to all HTML pages generated by Asciidoctor? There is an extension, but that's not available from the maven repository. I am using the asciidoctor-maven-plugin.
Create a file index-docinfo-footer.html if your file is index.adoc in the same directory and add :docinfo: in that adoc file.
Fill that footer file with:
<script type="text/javascript">
dataLayer = [{'channel' : '{html-googleTagManagerChannel}', 'additional_tracking_code' : '{html-googleAnalyticsId}'}];
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{html-googleTagManagerId}');</script>
<noscript><iframe src="//www.googletagmanager.com/ns.html?id={html-googleTagManagerId}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
And then do something like this in your pom.xml:
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<configuration>
<attributes>
<html-googleAnalyticsId>UA-123456789-1</html-googleAnalyticsId>
<html-googleTagManagerId>GTM-ABCDE</html-googleTagManagerId>
<html-googleTagManagerChannel>MyProject</html-googleTagManagerChannel>
</attributes>
</configuration>
If the extension is published on RubyGems, you can download the dependency with the TorqueBox RubyGems Maven Proxy Repository.
Have a look at the asciidoctor-pdf-with-theme-example in the asciidoctor maven examples.

How to add JS/CSS files to Joomla modules?

I am starting out with Joomla and am writing a simple Joomla module. I am using some custom CSS and JS in my module. Now when I distribute this module I need my JS/CSS files to go with the ZIP. I have added my files in my module ZIP file.
This is what i need to know -
How do I refer to these CSS/JS files in my module so that even if I distribute the module as a zip i would not have to send the css/js files separately?
I tried looking at different solutions including
http://www.howtojoomla.net/how-tos/development/how-to-add-cssjavascript-to-your-joomla-extension But I was not able to figure out what the URL for the JS/CSS file should be?
I am using Joomla 1.7 hosted on a cloud hosting site.
Thanks
I'd say that the HowToJoomla Site's article pretty much sums up the process.
Here is the process with a few more steps added - hopefully this will help.
I am assuming you have got as far as packaging your extension and have been able to get your css and javascript files to install on the server. They may be in your module folder, or probably more correctly they should be within your modules sub-folder under the /media/ folder.
If after installing the module you can not locate your css and js files it is because you haven't referenced them correctly within your component's xml installation file. This page contains info about the xml installation / manifest file for 1.6/1.7 add-ons although it is for a component: http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!1.6_-_Part_01 they are very similar.
Either way - find your files within Joomla's folder structure and make a note of their relative path from the root of the website - ie the folder containing configuration.php
Now somewhere within your module's php - add the line that gets a reference to the JDocument object.
$document = JFactory::getDocument();
Now add the line that adds your javascript to the html head area:
$document->addScript('url/to/my/script.js');
obviously replace 'url/to/my/script.js' with the actual relative path to your javascript.
Now add the line that adds your css to the html head:
$document->addStyleSheet('url/to/my/stylesheet.css');
again adjust the path - it may for example be media/mod_mymodule/mymodule.css (if your module were called 'mymodule').
Only things to be aware of are that you need to add these lineswithin executable php tags NOT within a html area after exiting php mode.
You could add your js/css files to /media folder.
http://docs.joomla.org/Manifest_files#Media_files
Just add to your manifest file:
<files>
...
</files>
<media folder="media" destination="mod_your_module">
<folder>css</folder>
<folder>js</folder>
</media>
Inside your installable package, you should now have the /media folder.
Then add to view file:
$doc =& JFactory::getDocument();
$doc->addScript("/media/mod_your_module/js/script.js");
This article explains the benefits of this approach:
http://blog.joomlatools.com/2008/09/hidden-feature-joomlas-media-folder.html
You could use:
JHTML::script('modules/mod_your_module/js/script.js');
JHTML::stylesheet('modules/mod_your_module/css/stylesheet.css');
This example does not require JFactory::getDocument()
$document = JFactory::getDocument();
$modulePath = JURI::base() . 'modules/mod_your_module_name/';
//Adding JS Files
$document->addScript($modulePath.'js/myscript.js');
//Adding CSS Files
$document->addStyleSheet($modulePath.'css/style.css');
<script type="text/javascript" src="<?php echo JURI::BASE()?>modules/your_module_name/js/your_js_file"></script>
for Css:
<link href="<?php echo JURI::BASE()?>modules/your_module_name/css/your_css _file" type="text/css" media="all" rel="stylesheet">

Simple question about the Google Sitemap

Can I code my sitemap this way and expect Google to crawl every links contain in the following page I have inserted below? Thanks!
<url>
<loc>http://www.domain.com/page/1</loc>
<lastmod>2010-11-28</lastmod>
<changefreq>daily</changefreq>
<priority>0.2</priority>
</url>
<url>
<loc>http://www.domain.com/page/2</loc>
<lastmod>2010-11-28</lastmod>
<changefreq>daily</changefreq>
<priority>0.2</priority>
</url>
yes
but don'T bother to much with changefreq or priority, it does not really do anything (according to my tests)

Resources